home *** CD-ROM | disk | FTP | other *** search
/ Aminet 38 / Aminet 38 (2000)(Schatztruhe)[!][Aug 2000].iso / Aminet / util / moni / Scout-src.lha / src / objects / scout_extras.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-03-09  |  85.0 KB  |  2,474 lines

  1. /**
  2.  * Scout - The Amiga System Monitor
  3.  *
  4.  *------------------------------------------------------------------
  5.  *
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License as published by
  8.  * the Free Software Foundation; either version 2 of the License, or
  9.  * any later version.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program; if not, write to the Free Software
  18.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  *
  20.  * You must not use this source code to gain profit of any kind!
  21.  *
  22.  *------------------------------------------------------------------
  23.  *
  24.  * @author Andreas Gelhausen
  25.  * @author Richard Körber <rkoerber@gmx.de>
  26.  */
  27.  
  28.  
  29.  
  30. #define USE_SCOUT_LOGO_COLORS
  31. #define USE_SCOUT_LOGO_BODY
  32.  
  33. #include "scout_extras.h"
  34. #include "/scout_logo.h"
  35.  
  36. #define WINDOWTITLELEN  80
  37.  
  38. extern struct Library   *GfxBase;
  39. extern struct ExecBase  *SysBase;
  40. extern APTR AboutText;
  41.  
  42. static char SPACE40[] = "                                        ";
  43.  
  44. UBYTE  updatetimetext[] = "1.0\0\0\0\0\0";
  45. ULONG  updatetimestate;
  46.  
  47. ULONG MakeListID (char a, char b, char c, char d) {
  48.  
  49.    if (opts.SingleWindows) {
  50.       return ((ULONG) ('L')<<24 | (ULONG) ('I')<<16 | (ULONG) ('S')<<8 | (ULONG) ('T'));
  51.    } else {
  52.       return ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d));
  53.    }
  54. }
  55.  
  56. ULONG MakeDetailID (char a, char b, char c, char d) {
  57.  
  58. //   if (opts.SingleWindows) {
  59. //      return ((ULONG) ('M')<<24 | (ULONG) ('O')<<16 | (ULONG) ('R')<<8 | (ULONG) ('E'));
  60. //   } else {
  61.       return ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d));
  62. //   }
  63. }
  64.  
  65. struct Node *HandleNodeDetails (APTR list, char *type) {
  66.    struct ListEntry  *entryp;
  67.    struct Node       *node = NULL;
  68.  
  69.    if (entryp = GetActiveEntry (list)) {
  70.       node = MyFindName (type, entryp->le_address);
  71.       if (!node)
  72.          MyRequest ("Continue", "Sorry, can't find that %ls!", type);
  73.    }
  74.    return (node);
  75. }
  76.  
  77. void MySetContents (APTR textfield, char *fmt, ...) {
  78.    va_list arg;
  79.    char buf[512];
  80.  
  81.    va_start(arg,fmt);
  82.    vsprintf(buf, fmt, arg);
  83.    va_end(arg);
  84.  
  85.    set (textfield, MUIA_Text_Contents, buf);
  86. }
  87.  
  88. void MySetContentsHealed (APTR textfield, char *fmt, ...) {
  89.    va_list arg;
  90.    char buf[512];
  91.  
  92.    va_start(arg,fmt);
  93.    vsprintf(buf, fmt, arg);
  94.    va_end(arg);
  95.  
  96.    healstring (buf);
  97.    set (textfield, MUIA_Text_Contents, buf);
  98. }
  99.  
  100. void MyFreeStructs (struct Remember **rem, APTR listtext, APTR list) {
  101.    if (*rem) {
  102.       if (AP_Scout) {
  103.          if (listtext)
  104.             set (listtext,MUIA_Text_Contents,"");
  105.          if (list)
  106.             DoMethod (list,MUIM_List_Clear);
  107.       }
  108.       FreeRemember (rem, TRUE);
  109.       *rem = NULL;
  110.    }
  111. }
  112.  
  113. void SetCountText (APTR counttext, int structcnt) {
  114.    MySetContents (counttext, ESC "r%04d", structcnt);
  115. }
  116.  
  117. void SetCloseRequest (APTR window, int id) {
  118.    DoMethod (window,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,AP_Scout,2,MUIM_Application_ReturnID,id);
  119. }
  120.  
  121. struct WinFree *SingleDetailWinFree = NULL;
  122.  
  123. char *MyGetWindowTitle (char *titleptr, char *type) {
  124.    int i;
  125.  
  126.    if (type[0] == '\0') {
  127.       strcpy (tmpstr, "SCOUT");
  128.    } else {
  129.       sprintf (tmpstr, "SCOUT: %ls", type);
  130.    }
  131.    Forbid();
  132.    if (FindPort ("AMITCP")) {
  133.       Permit();
  134.       if (opts.Host) {
  135.          strcat (tmpstr, "   [ ");
  136.          strcat (tmpstr, opts.Host);
  137.          strcat (tmpstr, " ]");
  138.       } else {
  139.          Permit();
  140.          strcat (tmpstr, "   [ LOCALHOST ]");
  141.       }
  142.    }
  143.  
  144.    for (i = 7; i < strlen (tmpstr); i++) {
  145.       tmpstr[i] = toupper (tmpstr[i]);
  146.    }
  147.    strcpy (titleptr, tmpstr);
  148.    return (titleptr);
  149. }
  150.  
  151. void HandleFlagsButtonPressed (APTR button, struct WinFree *ptr, char *title2, char *fieldname, ULONG flags, struct LongFlag *longflag, struct MaskedLongFlag *mlongflag, char fieldtype) {
  152.    struct WinFlag *winflag;
  153.  
  154.    if (winflag = AllocRemember (&ptr->wf_RememberKey, sizeof (struct WinFlag), MEMF_ANY|MEMF_CLEAR)) {
  155.       winflag->wf_title2 = title2;
  156.       winflag->wf_fieldname = fieldname;
  157.       winflag->wf_flags = flags;
  158.       winflag->wf_longflag = longflag;
  159.       winflag->wf_mlongflag = mlongflag;
  160.       winflag->wf_fieldtype = fieldtype;
  161.       DoMethod (button,MUIM_Notify,MUIA_Pressed,FALSE,AP_Scout,3,MUIM_WriteLong,(ULONG) winflag,(ULONG *) &WinFlag_ToDo);
  162.    }
  163. }
  164.  
  165. void HandleWindowOpen (struct WinFree *ptr, char *titlepart1, char *titlepart2) {
  166.    UBYTE *fulltitle;
  167.    UBYTE *titlepart2ptr;
  168.  
  169.    if (opts.SingleWindows && SingleDetailWinFree) {
  170.       WinFree_ToDo = SingleDetailWinFree;
  171.       RemoveWinFree ();
  172.    }
  173.    SingleDetailWinFree = ptr;
  174.    titlepart2ptr = nonetest (titlepart2);
  175.  
  176.    fulltitle = AllocRemember (&ptr->wf_RememberKey, strlen(titlepart1) + strlen(titlepart2ptr) + 4, MEMF_ANY|MEMF_CLEAR);
  177.    sprintf (fulltitle, "%s%s", titlepart1, titlepart2ptr);
  178.    healstring (fulltitle);
  179.  
  180.    set (ptr->wf_Window,MUIA_Window_Title,fulltitle);
  181.    DoMethod (AP_Scout,OM_ADDMEMBER,ptr->wf_Window);
  182.    SetWindowOpen (ptr->wf_Window,NULL,NULL);
  183. }
  184.  
  185. void HandleWindowClose (struct WinFree *ptr) {
  186.    DoMethod (ptr->wf_Window,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,AP_Scout,3,MUIM_WriteLong,(ULONG) ptr,(ULONG *) &WinFree_ToDo);
  187.    SetCloseRequest (ptr->wf_Window,ID_REMOVEWINFREE);
  188. }
  189.  
  190. ULONG LastListID = NULL;
  191.  
  192. void SetWindowOpen (APTR window, APTR active, ULONG ListID) {
  193.    if (opts.SingleWindows) {
  194.       if (ListID) {
  195.          if (LastListID && (LastListID != ListID)) {
  196.             if (SingleDetailWinFree) {
  197.                WinFree_ToDo = SingleDetailWinFree;
  198.                RemoveWinFree ();
  199.             }
  200.           DoMethod (AP_Scout,MUIM_Application_ReturnID,LastListID);
  201.          }
  202.          LastListID = ListID;
  203.       }
  204.    }
  205.  
  206.    set (window,MUIA_Window_Open,TRUE);
  207. }
  208.  
  209. void SetWindowClose (APTR window, BOOL IsList) {
  210.    if (opts.SingleWindows && IsList) {
  211.       if (SingleDetailWinFree) {
  212.          WinFree_ToDo = SingleDetailWinFree;
  213.          RemoveWinFree ();
  214.       }
  215.    }
  216.    set (window,MUIA_Window_Open,FALSE);
  217. }
  218.  
  219. void ApplicationSleep (void) {
  220.    set (AP_Scout,MUIA_Application_Sleep,TRUE);
  221. }
  222.  
  223. void AwakeApplication (void) {
  224.    set (AP_Scout,MUIA_Application_Sleep,FALSE);
  225. }
  226.  
  227. void RedrawActiveEntry (APTR list) {
  228.    DoMethod (list, MUIM_List_Redraw, MUIV_List_Redraw_Active);
  229. }
  230.  
  231. void RemoveActiveEntry (APTR list) {
  232.    DoMethod (list, MUIM_List_Remove, MUIV_List_Redraw_Active);
  233. }
  234.  
  235. void InsertBottomEntry (APTR list, APTR *entry) {
  236.    DoMethod (list, MUIM_List_Insert, entry, 1, MUIV_List_Insert_Bottom);
  237. }
  238.  
  239. void InsertSortedEntry (APTR list, APTR *entry) {
  240.    DoMethod (list, MUIM_List_Insert, entry, 1, MUIV_List_Insert_Sorted);
  241. }
  242.  
  243. struct ListEntry *GetActiveEntry (APTR list) {
  244.    struct ListEntry *result = NULL;
  245.    
  246.    if (list)
  247.       DoMethod (list,MUIM_List_GetEntry,MUIV_List_GetEntry_Active,&result);
  248.    return (result);
  249. }
  250.  
  251. void SetListActive (APTR list, int id) {
  252.    DoMethod (list,MUIM_Notify,MUIA_List_Active,MUIV_EveryTime,AP_Scout,2,MUIM_Application_ReturnID,id);
  253. }
  254.  
  255. void SetListviewDoubleClick (APTR list, int id) {
  256.    if (! clientstate)
  257.       DoMethod (list,MUIM_Notify,MUIA_Listview_DoubleClick,TRUE,AP_Scout,2,MUIM_Application_ReturnID,id);
  258. }
  259.  
  260. APTR KeyButtonA (char *buttontext, int buttonid) {
  261.    APTR result;
  262.    result = MUI_MakeObject (MUIO_Button, buttontext);
  263.    DoMethod (result,MUIM_Notify,MUIA_Pressed,FALSE,AP_Scout,2,MUIM_Application_ReturnID,buttonid);
  264.    return (result);
  265. }
  266.  
  267. APTR KeyButtonB (char *buttontext, char key, int buttonid) {
  268.    APTR result;
  269.    result = KeyButton (buttontext, key);
  270.    DoMethod (result,MUIM_Notify,MUIA_Pressed,FALSE,AP_Scout,2,MUIM_Application_ReturnID,buttonid);
  271.    return (result);
  272. }
  273.  
  274. APTR KeyButtonF (char fieldtype, ULONG flags) {
  275.    APTR result;
  276.    char buttontext[16];
  277.  
  278.    if (fieldtype == 'l') {
  279.       sprintf (buttontext, ESC "b$%08lx", (ULONG) flags);
  280.    } else if (fieldtype == 'w') {
  281.       sprintf (buttontext, ESC "b$%04lx", (UWORD) flags);
  282.    } else {
  283.       sprintf (buttontext, ESC "b%%%ls", ltob ((ULONG) flags, 8));
  284.    }
  285.    result = TextObject,\
  286.                 ButtonFrame,\
  287.                       MUIA_Text_Contents, buttontext,\
  288.                 MUIA_Text_PreParse, "\33r",\
  289.                 MUIA_InputMode    , MUIV_InputMode_RelVerify,\
  290.                 MUIA_Background   , MUII_ButtonBack,\
  291.                 End;
  292.  
  293.    DoMethod (result,MUIM_Notify,MUIA_Pressed,FALSE,AP_Scout,2,MUIM_Application_ReturnID,ID_FLAGWINDOW);
  294.    return (result);
  295. }
  296.  
  297. __asm LONG flaglist_dspfunc(register __a2 char **array, register __a1 struct FlagEntry *flagentry, register __a0 struct Hook *hook) {
  298.    if (flagentry) {
  299.       *array++ = flagentry->fe_name;
  300.       *array++ = flagentry->fe_text;
  301.       *array   = NULL;
  302.    }
  303.    return(0);
  304. }
  305.  
  306. struct Hook flaglist_dsphook = {
  307.  {NULL, NULL},
  308.  (ULONG (* )())flaglist_dspfunc,
  309.  NULL, NULL
  310. };
  311.  
  312. void GetFlagsMore (char *title2, char *fieldname, ULONG flags, struct LongFlag *longflag, struct MaskedLongFlag *mlongflag, char fieldtype) {
  313.    unsigned char     flaglabel[40];
  314.    struct   WinFree  *ptr;
  315.    APTR  flagsmorelist;
  316.  
  317.  
  318.    if (fieldtype == 'l') {
  319.       sprintf ((char *) &flaglabel, "%ls = $%08lx", fieldname, flags);
  320.    } else if (fieldtype == 'w') {
  321.       sprintf ((char *) &flaglabel, "%ls = $%04lx", fieldname, flags);
  322.    } else {
  323.       sprintf ((char *) &flaglabel, "%ls = %%%ls", fieldname, ltob ((ULONG) flags, 8));
  324.    }
  325.  
  326.    if (ptr = AllocWinFree()) {
  327.       ptr->wf_Window = (APTR) WindowObject,
  328.  
  329. //      MUIA_Window_SizeGadget, FALSE,
  330.       MUIA_Window_ID, MakeDetailID('F','L','A','G'),
  331.       WindowContents, VGroup,
  332.          Child, HGroup,
  333.             Child, MyHSpace (0),
  334.             Child, MyLabel2 (flaglabel),
  335.             Child, MyHSpace (0),
  336.          End,
  337.          Child, flagsmorelist = ListviewObject,
  338.             MUIA_Listview_DoubleClick, TRUE,
  339.             MUIA_Listview_Input, FALSE,
  340.             MUIA_Listview_List, ListObject,
  341.             MUIA_List_Format, "COL=0 DELTA=8,COL=1",
  342. //            MUIA_List_Title, TRUE,
  343.             MUIA_List_DisplayHook, &flaglist_dsphook,
  344.             ReadListFrame,
  345.          End, End,
  346.       End, End;
  347.  
  348.       if (ptr->wf_Window) {
  349.          int i = 0;
  350.  
  351.          set(flagsmorelist,MUIA_List_Quiet,TRUE);
  352.          if (longflag) {
  353.             while (((struct LongFlag *) &longflag[i])->lf_name) {
  354.                if (flags & ((struct LongFlag *) &longflag[i])->lf_value) {
  355.                   DoMethod (flagsmorelist,MUIM_List_InsertSingle,((struct FlagEntry *) &((struct LongFlag *) &longflag[i])->lf_name),MUIV_List_Insert_Bottom);
  356.                }
  357.                i++;
  358.             }
  359.          }
  360.          i = 0;
  361.          if (mlongflag) {
  362.             while (((struct MaskedLongFlag *) &mlongflag[i])->mlf_name) {
  363.                if ((flags & ((struct MaskedLongFlag *) &mlongflag[i])->mlf_mask) == ((struct MaskedLongFlag *) &mlongflag[i])->mlf_value) {
  364.                   DoMethod (flagsmorelist,MUIM_List_InsertSingle,((struct FlagEntry *) &((struct MaskedLongFlag *) &mlongflag[i])->mlf_name),MUIV_List_Insert_Bottom);
  365.                }
  366.                i++;
  367.             }
  368.          }
  369.          set(flagsmorelist,MUIA_List_Quiet,FALSE);
  370.  
  371.          HandleWindowOpen (ptr, "FLAGS  ", title2);
  372.          set (ptr->wf_Window,MUIA_Window_ActiveObject,flagsmorelist);
  373.          HandleWindowClose (ptr);
  374.       }
  375.    }
  376. }
  377.  
  378. APTR MyListviewObject (unsigned char *formatstring, APTR displayhook) {
  379.    return (ListviewObject,
  380.             MUIA_Listview_List, ListObject,
  381.             MUIA_List_Format, formatstring,
  382.             MUIA_List_Title, TRUE,
  383.             MUIA_List_DisplayHook, displayhook,
  384.             InputListFrame,
  385.            End, End);
  386. }
  387.  
  388. /*
  389. APTR MyBelowSortedListview (APTR *text, APTR *count, APTR *cycle, const char *sorttext[], int sortstate) {
  390.  return (HGroup,
  391.             Child, VGroup,
  392.                Child, *text = MyTextObject5(SPACE40),
  393.                   Child, MyLabel ("sorted by:"),
  394.                End,
  395.                Child, VGroup, MUIA_HorizWeight, 0,
  396.                   Child, HGroup,
  397.                      Child, MyLabel (" Cnt:"),
  398.                      Child, *count = MyTextObject4("0000"),
  399.                   End,
  400.                   Child, *cycle = CycleObject,
  401.                      MUIA_Cycle_Entries, sorttext,
  402.                      MUIA_Cycle_Active, sortstate,
  403.                   End,
  404.                End,
  405.             End);
  406. }
  407. */
  408.  
  409. APTR MyBelowSortedListview (APTR *text, APTR *count, APTR *cycle, const char *sorttext[], int sortstate) {
  410.  return (HGroup,
  411.             Child, *text = MyTextObject5(SPACE40),
  412.             Child, HGroup, MUIA_HorizWeight, 0,
  413.                Child, MyLabel (" Cnt:"),
  414.                Child, *count = MyTextObject4("0000"),
  415.                Child, MyLabel ("sorted by:"),
  416.                Child, *cycle = CycleObject,
  417.                   MUIA_Cycle_Entries, sorttext,
  418.                   MUIA_Cycle_Active, sortstate,
  419.                End,
  420.             End,
  421.          End);
  422. }
  423.  
  424. APTR MyBelowListview (APTR *text, APTR *count) {
  425.  return (HGroup,
  426.          Child, *text = MyTextObject5(SPACE40),
  427.          Child, HGroup, MUIA_HorizWeight, 0,
  428.             Child, MyLabel (" Cnt:"),
  429.             Child, *count = MyTextObject4("0000"),
  430.          End,End);
  431. }
  432.  
  433. APTR MyLabel (char *labeltext) {
  434.    return (LabelA (labeltext));
  435. }
  436.  
  437. APTR MyLabel2 (char *labeltext) {
  438.    return (LabelB (labeltext));
  439. }
  440.  
  441. APTR MyHSpace (int size) {
  442.    return (HSpace (size));
  443. }
  444.  
  445. APTR MyVSpace (int size) {
  446.    return (VSpace (size));
  447. }
  448.  
  449. APTR MyTextObject () {
  450.    return ( TextObject, MyTextFrame, End );
  451. }
  452.  
  453. APTR MyTextObject2 () {
  454.    return ( TextObject, MyTextFrame, MUIA_Text_SetMax, TRUE, End );
  455. }
  456.  
  457. APTR MyTextObject3 (char *text) {
  458.    return ( TextObject, MyTextFrame, MUIA_Text_Contents, text, End );
  459. }
  460.  
  461. APTR MyTextObject4 (char *text) {
  462.    return ( TextObject, MyTextFrame, MUIA_Text_SetMax, TRUE, MUIA_Text_Contents, text, End );
  463. }
  464.  
  465. APTR MyTextObject5 (char *text) {
  466.    return ( TextObject, MyTextFrame, MUIA_Text_SetMin, TRUE, MUIA_Text_Contents, text, End );
  467. }
  468.  
  469. const char *AboutText1  = MUIX_C "\n"\
  470.                           PROGNAME " V" PROGVERSION "." PROGREVISION "\n"\
  471.                           "Release " RELEASEVERSION "." RELEASEREVISION " (" RELEASEDATE ")\n"\
  472.                           COPYRIGHT "\nAll Rights Reserved\n\n"\
  473.                           "This program is \33bFreeWare\33n.\n"\
  474.                           "MUI is © by Stefan Stuntz.\n\n"\
  475.                           "\33lEMail: " EMAIL "\nURL: " URL "\n\n"\
  476.                           "ARexx port name: ";
  477.  
  478. static char *VectorPages[] = { "ResetVecs","AutoVecInts","IntVecs",NULL };
  479. static char *AllocationsPages[] = { "CIA","Ports",NULL };
  480. char  LibDevResFormatText[] = "COL=0 DELTA=8,COL=1 DELTA=8,COL=2 DELTA=8 P=\33r,COL=3 DELTA=8 P=\33r,COL=4 DELTA=8 P=\33r,COL=5";
  481.  
  482. __asm LONG list_cmpaddressfunc (register __a1 struct ListEntry *le1, register __a2 struct ListEntry *le2) {
  483.    return (strcmpi (le1->le_address, le2->le_address));
  484. }
  485.  
  486. struct Hook list_cmpaddresshook = {
  487.  {NULL, NULL},
  488.  (ULONG (* )())list_cmpaddressfunc,
  489.  NULL, NULL
  490. };
  491.  
  492. __asm LONG list_cmpnormalfunc (register __a1 struct ListEntry *le1, register __a2 struct ListEntry *le2) {
  493.    return (1);
  494. }
  495.  
  496. struct Hook list_cmpnormalhook = {
  497.  {NULL, NULL},
  498.  (ULONG (* )())list_cmpnormalfunc,
  499.  NULL, NULL
  500. };
  501.  
  502. __asm LONG list_cmpnamefunc (register __a1 struct ListEntry *le1, register __a2 struct ListEntry *le2) {
  503.    LONG result;
  504.    if (result = strcmpi (le1->le_name, le2->le_name))
  505.       return (result);
  506.    return (1);
  507. }
  508.  
  509. struct Hook list_cmpnamehook = {
  510.  {NULL, NULL},
  511.  (ULONG (* )())list_cmpnamefunc,
  512.  NULL, NULL
  513. };
  514.  
  515. __asm LONG locklist_cmppathfunc (register __a1 struct LockEntry *le1, register __a2 struct LockEntry *le2) {
  516.    return (strcmpi (le1->lock_path, le2->lock_path));
  517. }
  518.  
  519. struct Hook locklist_cmppathhook = {
  520.  {NULL, NULL},
  521.  (ULONG (* )())locklist_cmppathfunc,
  522.  NULL, NULL
  523. };
  524.  
  525. __asm LONG tasklist_cmpprifunc (register __a1 struct TaskEntry *te1, register __a2 struct TaskEntry *te2) {
  526.    long  eins = NULL, zwei = NULL;
  527.  
  528.    IsDec (te1->ts_pri, &eins);
  529.    IsDec (te2->ts_pri, &zwei);
  530.    if (eins < zwei)
  531.       return (1);
  532.    return (-1);
  533. }
  534.  
  535. struct Hook tasklist_cmpprihook = {
  536.  {NULL, NULL},
  537.  (ULONG (* )())tasklist_cmpprifunc,
  538.  NULL, NULL
  539. };
  540.  
  541. __asm LONG tasklist_cmpaddressfunc (register __a1 struct ListEntry *le1, register __a2 struct ListEntry *le2) {
  542.    if (le1->le_adr < le2->le_adr)
  543.       return (-1);
  544.    return (1);
  545. }
  546.  
  547. struct Hook tasklist_cmpaddresshook = {
  548.  {NULL, NULL},
  549.  (ULONG (* )())tasklist_cmpaddressfunc,
  550.  NULL, NULL
  551. };
  552.  
  553. __asm LONG cxlist_cmpprifunc (register __a1 struct CxEntry *ce1, register __a2 struct CxEntry *ce2) {
  554.    long  eins = NULL, zwei = NULL;
  555.  
  556.    IsDec (ce1->cxe_pri, &eins);
  557.    IsDec (ce2->cxe_pri, &zwei);
  558.    if (eins < zwei)
  559.       return (1);
  560.    return (-1);
  561. }
  562.  
  563. struct Hook cxlist_cmpprihook = {
  564.  {NULL, NULL},
  565.  (ULONG (* )())cxlist_cmpprifunc,
  566.  NULL, NULL
  567. };
  568.  
  569. __asm LONG cxlist_cmpaddressfunc (register __a1 struct CxEntry *ce1, register __a2 struct CxEntry *ce2) {
  570.    if (ce1->cxe_adr < ce2->cxe_adr)
  571.       return (-1);
  572.    return (1);
  573. }
  574.  
  575. struct Hook cxlist_cmpaddresshook = {
  576.  {NULL, NULL},
  577.  (ULONG (* )())cxlist_cmpaddressfunc,
  578.  NULL, NULL
  579. };
  580.  
  581. __asm LONG cxlist_cmpnamefunc (register __a1 struct CxEntry *ce1, register __a2 struct CxEntry *ce2) {
  582.    LONG result;
  583.    if (result = strcmpi (ce1->cxe_name, ce2->cxe_name))
  584.       return (result);
  585.    return (1);
  586. }
  587.  
  588. struct Hook cxlist_cmpnamehook = {
  589.  {NULL, NULL},
  590.  (ULONG (* )())cxlist_cmpnamefunc,
  591.  NULL, NULL
  592. };
  593.  
  594. __asm LONG classlist_cmpaddressfunc (register __a1 struct ClassEntry *ce1, register __a2 struct ClassEntry *ce2) {
  595.    if (ce1->cse_adr < ce2->cse_adr)
  596.       return (-1);
  597.    return (1);
  598. }
  599.  
  600. struct Hook classlist_cmpaddresshook = {
  601.  {NULL, NULL},
  602.  (ULONG (* )())classlist_cmpaddressfunc,
  603.  NULL, NULL
  604. };
  605.  
  606. __asm LONG classlist_cmpnamefunc (register __a1 struct ClassEntry *ce1, register __a2 struct ClassEntry *ce2) {
  607.    LONG result;
  608.    if (result = strcmpi (ce1->cse_classname, ce2->cse_classname))
  609.       return (result);
  610.    return (1);
  611. }
  612.  
  613. struct Hook classlist_cmpnamehook = {
  614.  {NULL, NULL},
  615.  (ULONG (* )())classlist_cmpnamefunc,
  616.  NULL, NULL
  617. };
  618.  
  619. __asm LONG classlist_cmpsuperfunc (register __a1 struct ClassEntry *ce1, register __a2 struct ClassEntry *ce2) {
  620.    LONG result;
  621.    if (result = strcmpi (ce1->cse_super, ce2->cse_super))
  622.       return (result);
  623.    return (1);
  624. }
  625.  
  626. struct Hook classlist_cmpsuperhook = {
  627.  {NULL, NULL},
  628.  (ULONG (* )())classlist_cmpsuperfunc,
  629.  NULL, NULL
  630. };
  631.  
  632. __asm LONG smodelist_cmpidfunc (register __a1 struct SModeEntry *se1, register __a2 struct SModeEntry *se2) {
  633.    if (se1->sme_smodeid < se2->sme_smodeid)
  634.       return (-1);
  635.    return (1);
  636. }
  637.  
  638. struct Hook smodelist_cmpidhook = {
  639.  {NULL, NULL},
  640.  (ULONG (* )())smodelist_cmpidfunc,
  641.  NULL, NULL
  642. };
  643.  
  644. __asm LONG smodelist_cmpresfunc (register __a1 struct SModeEntry *se1, register __a2 struct SModeEntry *se2) {
  645.    long  eins = NULL, zwei = NULL;
  646.  
  647.    IsDec (se1->sme_width, &eins);
  648.    IsDec (se2->sme_width, &zwei);
  649.    if(eins!=zwei) return(eins>zwei ? 1 : -1);
  650.    IsDec (se1->sme_height, &eins);
  651.    IsDec (se2->sme_height, &zwei);
  652.    if(eins!=zwei) return(eins>zwei ? 1 : -1);
  653.    IsDec (se1->sme_depth, &eins);
  654.    IsDec (se2->sme_depth, &zwei);
  655.    return(eins>zwei ? 1 : -1);
  656. }
  657.  
  658. struct Hook smodelist_cmpreshook = {
  659.  {NULL, NULL},
  660.  (ULONG (* )())smodelist_cmpresfunc,
  661.  NULL, NULL
  662. };
  663.  
  664. __asm LONG smodelist_cmpnamefunc (register __a1 struct SModeEntry *se1, register __a2 struct SModeEntry *se2) {
  665.    STRPTR s1 = se1->sme_name, s2 = se2->sme_name;
  666.    LONG result;
  667.  
  668. //*   if(*s1=='\033') s1+=2;
  669. //*   if(*s2=='\033') s2+=2;
  670.  
  671.    if (result = strcmpi (s1,s2))
  672.       return (result);
  673.    return (1);
  674. }
  675.  
  676. struct Hook smodelist_cmpnamehook = {
  677.  {NULL, NULL},
  678.  (ULONG (* )())smodelist_cmpnamefunc,
  679.  NULL, NULL
  680. };
  681.  
  682.  
  683. char main_title[WINDOWTITLELEN];
  684.  
  685. APTR GetApplication (void) {
  686.    AP_Scout = ApplicationObject,
  687.       MUIA_Application_Title      , PROGNAME,
  688.       MUIA_Application_Version    , "$VER: " VERSIONSTRING,
  689.       MUIA_Application_Copyright  , COPYRIGHT,
  690.       MUIA_Application_Author     , AUTHOR,
  691.       MUIA_Application_Description, DESCRIPTION,
  692.       MUIA_Application_Base       , PROGNAME,
  693.       MUIA_Application_Commands   , arexx_list,
  694.       MUIA_Application_Menu       , menu_list,
  695. //      MUIA_Application_SingleTask , TRUE,
  696. //      MUIA_Application_DiskObject , &scout_sleep_dobj,
  697.       MUIA_Application_HelpFile   , "scout.guide",
  698.    End;
  699.  
  700.    if (AP_Scout) {
  701.       WI_Main = WindowObject,
  702.       MUIA_Window_Title, MyGetWindowTitle (main_title, ""),
  703.          MUIA_HelpNode, "Main",
  704.          MUIA_Window_ID, MakeID('M','A','I','N'),
  705.          WindowContents, HGroup,
  706.             MUIA_Group_SameHeight, TRUE,
  707.             Child, VGroup,                  /* This is the SCOUT logo */
  708.                MUIA_Weight    , 0,
  709.                MUIA_Frame     , MUIV_Frame_Text,
  710.                MUIA_Background, MUII_SHADOW,
  711.                Child, VSpace(0),
  712.                Child, BodychunkObject,
  713.                   MUIA_FixWidth             , SCOUT_LOGO_WIDTH ,
  714.                   MUIA_FixHeight            , SCOUT_LOGO_HEIGHT,
  715.                   MUIA_Bitmap_Width         , SCOUT_LOGO_WIDTH ,
  716.                   MUIA_Bitmap_Height        , SCOUT_LOGO_HEIGHT,
  717.                   MUIA_Bodychunk_Depth      , SCOUT_LOGO_DEPTH ,
  718.                   MUIA_Bodychunk_Body       , scout_logo_body  ,
  719.                   MUIA_Bodychunk_Compression, SCOUT_LOGO_COMPRESSION,
  720.                   MUIA_Bodychunk_Masking    , SCOUT_LOGO_MASKING,
  721.                   MUIA_Bitmap_SourceColors  , scout_logo_colors,
  722.                   MUIA_Bitmap_Transparent   , 0,
  723.                End,
  724.                Child, VSpace(0),
  725.             End,
  726.             Child, ColGroup(5),             /* And this are the buttons */
  727.                Child, BT_Libraries    = KeyButtonB (LibrariesText    ,'l',ID_LIBRARIES),
  728.                Child, BT_Devices      = KeyButtonB (DevicesText      ,'d',ID_DEVICES),
  729.                Child, BT_Resources    = KeyButtonB (ResourcesText    ,'u',ID_RESOURCES),
  730.                Child, BT_Semaphores   = KeyButtonB (SemaphoresText   ,'s',ID_SEMAPHORES),
  731.                Child, BT_Allocations  = KeyButtonB (AllocationsText  ,'a',ID_ALLOCATIONS),
  732.  
  733.                Child, BT_Tasks        = KeyButtonB (TasksText        ,'t',ID_TASKS),
  734.                Child, BT_Ports        = KeyButtonB (PortsText        ,'p',ID_PORTS),
  735.                Child, BT_Commodities  = KeyButtonB (CommoditiesText  ,'k',ID_COMMODITIES),
  736.                Child, BT_Interrupts   = KeyButtonB (InterruptsText   ,'i',ID_INTERRUPTS),
  737.                Child, BT_Vectors      = KeyButtonB (VectorsText      ,'v',ID_VECTORS),
  738.  
  739.                Child, BT_ScreenMode   = KeyButtonB (ScreenModeText   ,'z',ID_SCREENMODE),
  740.                Child, BT_Windows      = KeyButtonB (WindowsText      ,'w',ID_WINDOWS),
  741.                Child, BT_Fonts        = KeyButtonB (FontsText        ,'f',ID_FONTS),
  742.                Child, BT_Classes      = KeyButtonB (ClassesText      ,'b',ID_CLASSES),
  743.                Child, BT_InputHandler = KeyButtonB (InputHandlersText,'h',ID_INPUTHANDLER),
  744.  
  745.                Child, BT_Assigns      = KeyButtonB (AssignsText      ,'g',ID_ASSIGNS),
  746.                Child, BT_Locks        = KeyButtonB (LocksText        ,'o',ID_LOCKS),
  747.                Child, BT_Mount        = KeyButtonB (MountText        ,'n',ID_MOUNT),
  748.                Child, BT_Commands     = KeyButtonB (CommandsText     ,'c',ID_COMMANDS),
  749.                Child, BT_Timer        = KeyButtonB (TimerText        ,'e',ID_TIMER),
  750.  
  751.                Child, BT_System       = KeyButtonB (SystemText       ,'y',ID_SYSTEM),
  752.                Child, BT_Expansions   = KeyButtonB (ExpansionsText   ,'x',ID_EXPANSIONS),
  753.                Child, BT_Memory       = KeyButtonB (MemoryText       ,'m',ID_MEMORY),
  754.                Child, BT_LowMemory    = KeyButtonB (LowMemoryText    ,'j',ID_LOWMEMORY),
  755.                Child, BT_Residents    = KeyButtonB (ResidentsText    ,'r',ID_RESIDENTS),
  756.             End,
  757.          End,
  758.       End;
  759.  
  760.       if (WI_Main) {
  761.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Main);
  762.          SetCloseRequest (WI_Main,(int) MUIV_Application_ReturnID_Quit);
  763.          DoMethod (WI_Main,MUIM_Window_SetCycleChain,
  764.                     BT_Libraries,BT_Devices,BT_Resources,BT_System,
  765.                     BT_Tasks,BT_Ports,BT_Commands,BT_Commodities,
  766.                     BT_Expansions,BT_Memory,BT_Residents,BT_LowMemory,
  767.                     BT_Assigns,BT_Locks,BT_Mount,BT_Timer,
  768.                     BT_InputHandler,BT_Interrupts,BT_Vectors,BT_Allocations,
  769.                     BT_Fonts,BT_Semaphores,BT_Windows,BT_ScreenMode,NULL);
  770.  
  771. //         DoMethod (AP_Scout,MUIM_Notify,MUIA_Application_DoubleStart,TRUE,AsP_Scout,2,MUIM_Application_ReturnID,ID_DOUBLESTART);
  772.       }
  773.    }
  774.    return (AP_Scout);
  775. }
  776.  
  777. char mount_title[WINDOWTITLELEN];
  778.  
  779. void MountWindow (BOOL state) {
  780.    if (state) {
  781.       if (WI_Mount) {
  782.          ShowMounts();
  783.       } else {
  784.          WI_Mount = WindowObject,
  785.          MUIA_Window_Title, MyGetWindowTitle (mount_title, "MOUNTED DEVICES"),
  786.          MUIA_HelpNode, MountText,
  787.          MUIA_Window_ID, MakeListID('M','O','D','E'),
  788.          WindowContents, VGroup,
  789.             Child, mountlist = MyListviewObject ("COL=0 DELTA=8,COL=1 DELTA=8,COL=2 DELTA=8 P=\33r,COL=3 DELTA=8 P=\33r,COL=4 DELTA=8 P=\33r,COL=5 DELTA=8 P=\33c,COL=6 DELTA=8 P=\33c,COL=7",&mountlist_dsphook),
  790.             Child, MyBelowListview (&mounttext, &mountcount),
  791.             Child, MyVSpace(2),
  792.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  793.                Child, BT_MountUpdate = KeyButtonA (UpdateText,ID_MOUNTUPDATE),
  794.                Child, BT_MountPrint  = KeyButtonA (PrintText ,ID_MOUNTPRINT),
  795.                Child, BT_MountMore   = KeyButtonA (MoreText  ,ID_MOUNTMORE),
  796.                Child, BT_MountExit   = KeyButtonA (ExitText  ,ID_MOUNTEXIT),
  797.             End,
  798.          End, End;
  799.  
  800.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Mount);
  801.          DoMethod (WI_Mount,MUIM_Window_SetCycleChain,mountlist,BT_MountUpdate,BT_MountPrint,BT_MountMore,BT_MountExit,NULL);
  802.  
  803.          SetCloseRequest (WI_Mount,ID_MOUNTEXIT);
  804.          SetListActive (mountlist,ID_MOUNTLV_ACTIVE);
  805.          SetListviewDoubleClick (mountlist,ID_MOUNTMORE);
  806.  
  807.          ShowMounts();
  808.  
  809.          SetWindowOpen (WI_Mount,mountlist,ID_MOUNTEXIT);
  810.       }
  811.    } else if ((! state) && (WI_Mount)) {
  812.       SetWindowClose (WI_Mount,TRUE);
  813.  
  814.       FreeMounts();
  815.  
  816.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Mount);
  817.       MUI_DisposeObject (WI_Mount);
  818.       WI_Mount = NULL;
  819.       mountlist = NULL;
  820.    }
  821. }
  822.  
  823. char windows_title[WINDOWTITLELEN];
  824.  
  825. void WindowsWindow (BOOL state) {
  826.    if (state) {
  827.       if (WI_Windows) {
  828.          ShowWindows();
  829.       } else {
  830.          WI_Windows = WindowObject,
  831.          MUIA_Window_Title, MyGetWindowTitle (windows_title, "WINDOWS & SCREENS"),
  832.          MUIA_HelpNode, WindowsText,
  833.          MUIA_Window_ID, MakeListID('W','I','N','D'),
  834.          WindowContents, VGroup,
  835.             Child, winlist = MyListviewObject ("COL=0 DELTA=8,COL=1 DELTA=8 P=\33c,COL=2 DELTA=8 P=\33c,COL=3 DELTA=8,COL=4 DELTA=8,COL=5",&winlist_dsphook),
  836.             Child, wintext = MyTextObject(),
  837.             Child, MyVSpace(2),
  838.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  839.                Child, BT_WinUpdate  = KeyButtonA (UpdateText,ID_WINUPDATE),
  840.                Child, BT_WinPrint   = KeyButtonA (PrintText ,ID_WINPRINT),
  841.                Child, BT_WinClose   = KeyButtonA (CloseText ,ID_WINCLOSE),
  842.                Child, BT_WinToFront = KeyButtonA (ToFrontText ,ID_WINTOFRONT),
  843.                Child, BT_WinMore    = KeyButtonA (MoreText  ,ID_WINMORE),
  844.                Child, BT_WinExit    = KeyButtonA (ExitText  ,ID_WINEXIT),
  845.             End,
  846.          End, End;
  847.  
  848.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Windows);
  849.          DoMethod (WI_Windows,MUIM_Window_SetCycleChain,winlist,BT_WinUpdate,BT_WinPrint,BT_WinClose,BT_WinToFront,BT_WinMore,BT_WinExit,NULL);
  850.  
  851.          SetCloseRequest (WI_Windows,ID_WINEXIT);
  852.          SetListActive (winlist,ID_WINLV_ACTIVE);
  853.          SetListviewDoubleClick (winlist,ID_WINMORE);
  854.  
  855.          SetWindowOpen (WI_Windows,winlist,ID_WINEXIT);
  856.  
  857.          ShowWindows();
  858.       }
  859.    } else if ((! state) && (WI_Windows)) {
  860.       SetWindowClose (WI_Windows,TRUE);
  861.  
  862.       FreeWindows();
  863.  
  864.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Windows);
  865.       MUI_DisposeObject (WI_Windows);
  866.       WI_Windows = NULL;
  867.       winlist = NULL;
  868.    }
  869. }
  870.  
  871. char residents_title[WINDOWTITLELEN];
  872.  
  873. void ResidentsWindow (BOOL state) {
  874.    if (state) {
  875.       if (WI_Residents) {
  876.          ShowResidents();
  877.       } else {
  878.          WI_Residents = WindowObject,
  879.          MUIA_Window_Title, MyGetWindowTitle (residents_title, "RESIDENTS"),
  880.          MUIA_HelpNode, ResidentsText,
  881.          MUIA_Window_ID, MakeListID('R','E','S','I'),
  882.          WindowContents, VGroup,
  883.             Child, resilist = MyListviewObject ("COL=0 DELTA=8,COL=1 DELTA=8,COL=2 DELTA=8 P=\33r,COL=3",&resilist_dsphook),
  884.             Child, MyBelowListview (&resitext, &resicount),
  885.             Child, MyVSpace(2),
  886.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  887.                Child, BT_ResiUpdate     = KeyButtonA (UpdateText,ID_RESIUPDATE),
  888.                Child, BT_ResiPrint      = KeyButtonA (PrintText ,ID_RESIPRINT),
  889.                Child, BT_ResiMore       = KeyButtonA (MoreText  ,ID_RESIMORE),
  890.                Child, BT_ResiExit       = KeyButtonA (ExitText  ,ID_RESIEXIT),
  891.             End,
  892.          End, End;
  893.  
  894.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Residents);
  895.          DoMethod (WI_Residents,MUIM_Window_SetCycleChain,resilist,BT_ResiUpdate,BT_ResiPrint,BT_ResiMore,BT_ResiExit,NULL);
  896.  
  897.          SetCloseRequest (WI_Residents,ID_RESIEXIT);
  898.          SetListActive (resilist,ID_RESILV_ACTIVE);
  899.          SetListviewDoubleClick (resilist,ID_RESIMORE);
  900.  
  901.          ShowResidents();
  902.  
  903.          SetWindowOpen (WI_Residents,resilist,ID_RESIEXIT);
  904.       }
  905.    } else if ((! state) && (WI_Residents)) {
  906.       SetWindowClose (WI_Residents,TRUE);
  907.  
  908.       FreeResidents();
  909.  
  910.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Residents);
  911.       MUI_DisposeObject (WI_Residents);
  912.       WI_Residents = NULL;
  913.       resilist = NULL;
  914.    }
  915. }
  916.  
  917. char expansions_title[WINDOWTITLELEN];
  918.  
  919. void ExpansionsWindow (BOOL state) {
  920.    if (state) {
  921.       if (WI_Expansions) {
  922.          ShowExpansions();
  923.       } else {
  924.          WI_Expansions = WindowObject,
  925.          MUIA_Window_Title, MyGetWindowTitle (expansions_title, "EXPANSIONS"),
  926.          MUIA_HelpNode, ExpansionsText,
  927.          MUIA_Window_ID, MakeListID('E','X','P','A'),
  928.          WindowContents, VGroup,
  929.             Child, explist = MyListviewObject ("DELTA=8,DELTA=8,DELTA=8,,",&explist_dsphook),
  930.             Child, exptext = MyTextObject(),
  931.             Child, MyVSpace(2),
  932.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  933.                Child, BT_ExpPrint     = KeyButtonA (PrintText,ID_EXPPRINT),
  934.                Child, BT_ExpMore      = KeyButtonA (MoreText ,ID_EXPMORE),
  935.                Child, BT_ExpExit      = KeyButtonA (ExitText ,ID_EXPEXIT),
  936.             End,
  937.          End, End;
  938.  
  939.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Expansions);
  940.          DoMethod (WI_Expansions,MUIM_Window_SetCycleChain,explist,BT_ExpPrint,BT_ExpMore,BT_ExpExit,NULL);
  941.  
  942.          SetCloseRequest (WI_Expansions,ID_EXPEXIT);
  943.          SetListActive (explist,ID_EXPLV_ACTIVE);
  944.          SetListviewDoubleClick (explist,ID_EXPMORE);
  945.  
  946.          ShowExpansions();
  947.  
  948.          SetWindowOpen (WI_Expansions,explist,ID_EXPEXIT);
  949.       }
  950.    } else if ((! state) && (WI_Expansions)) {
  951.       SetWindowClose (WI_Expansions,TRUE);
  952.  
  953.       FreeExpansions();
  954.  
  955.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Expansions);
  956.       MUI_DisposeObject (WI_Expansions);
  957.       WI_Expansions = NULL;
  958.       explist = NULL;
  959.    }
  960. }
  961.  
  962. char inputhandler_title[WINDOWTITLELEN];
  963.  
  964. void InputHandlerWindow (BOOL state) {
  965.    if (state) {
  966.       if (WI_InputHandler) {
  967.          ShowInputHandler();
  968.       } else {
  969.          WI_InputHandler = WindowObject,
  970.          MUIA_Window_Title, MyGetWindowTitle (inputhandler_title, "INPUTHANDLERS"),
  971.          MUIA_HelpNode, InputHandlersText,
  972.          MUIA_Window_ID, MakeListID('I','N','P','U'),
  973.          WindowContents, VGroup,
  974.             Child, inputlist = MyListviewObject ("COL=0 DELTA=8,COL=1 DELTA=8,COL=2 DELTA=8,COL=3 DELTA=8 P=\33r,COL=4 DELTA=8,COL=5",&inputlist_dsphook),
  975.             Child, MyBelowListview (&inputtext, &inputcount),
  976.             Child, MyVSpace(2),
  977.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  978.                Child, BT_InputUpdate    = KeyButtonA (UpdateText  ,ID_INPUTUPDATE),
  979.                Child, BT_InputPrint     = KeyButtonA (PrintText   ,ID_INPUTPRINT),
  980.                Child, BT_InputRemove    = KeyButtonA (RemoveText  ,ID_INPUTREMOVE),
  981.                Child, BT_InputPriority  = KeyButtonA (PriorityText,ID_INPUTPRIORITY),
  982.                Child, BT_InputExit      = KeyButtonA (ExitText    ,ID_INPUTEXIT),
  983.             End,
  984.          End, End;
  985.  
  986.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_InputHandler);
  987.          DoMethod (WI_InputHandler,MUIM_Window_SetCycleChain,inputlist,BT_InputUpdate,BT_InputPrint,BT_InputRemove,BT_InputPriority,BT_InputExit,NULL);
  988.  
  989.          SetCloseRequest (WI_InputHandler,ID_INPUTEXIT);
  990.          SetListActive (inputlist,ID_INPUTLV_ACTIVE);
  991.  
  992.          ShowInputHandler();
  993.  
  994.          SetWindowOpen (WI_InputHandler,inputlist,ID_INPUTEXIT);
  995.       }
  996.    } else if ((! state) && (WI_InputHandler)) {
  997.       SetWindowClose (WI_InputHandler,TRUE);
  998.  
  999.       FreeInputHandler();
  1000.  
  1001.       DoMethod (AP_Scout,OM_REMMEMBER,WI_InputHandler);
  1002.       MUI_DisposeObject (WI_InputHandler);
  1003.       WI_InputHandler = NULL;
  1004.       inputlist = NULL;
  1005.    }
  1006. }
  1007.  
  1008. char lowmemory_title[WINDOWTITLELEN];
  1009.  
  1010. void LowMemoryWindow (BOOL state) {
  1011.    if (state) {
  1012.       if (WI_LowMemory) {
  1013.          ShowLowMemory();
  1014.       } else {
  1015.          WI_LowMemory = WindowObject,
  1016.          MUIA_Window_Title, MyGetWindowTitle (lowmemory_title, "LOWMEMORY"),
  1017.          MUIA_HelpNode, LowMemoryText,
  1018.          MUIA_Window_ID, MakeListID('L','O','W','M'),
  1019.          WindowContents, VGroup,
  1020.             Child, lowmemorylist = MyListviewObject ("COL=0 DELTA=8,COL=1 DELTA=8,COL=2 DELTA=8,COL=3 DELTA=8 P=\33r,COL=4 DELTA=8,COL=5",&lowmemorylist_dsphook),
  1021.             Child, MyBelowListview (&lowmemorytext, &lowmemorycount),
  1022.             Child, MyVSpace(2),
  1023.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  1024.                Child, BT_LowMemoryUpdate    = KeyButtonA (UpdateText  ,ID_LOWMEMORYUPDATE),
  1025.                Child, BT_LowMemoryPrint     = KeyButtonA (PrintText   ,ID_LOWMEMORYPRINT),
  1026. //*               Child, BT_LowMemoryCause     = KeyButtonA (CauseText   ,ID_LOWMEMORYCAUSE),
  1027.                Child, BT_LowMemoryRemove    = KeyButtonA (RemoveText  ,ID_LOWMEMORYREMOVE),
  1028.                Child, BT_LowMemoryPriority  = KeyButtonA (PriorityText,ID_LOWMEMORYPRIORITY),
  1029.                Child, BT_LowMemoryExit      = KeyButtonA (ExitText    ,ID_LOWMEMORYEXIT),
  1030.             End,
  1031.          End, End;
  1032.  
  1033.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_LowMemory);
  1034.          DoMethod (WI_LowMemory,MUIM_Window_SetCycleChain,lowmemorylist,BT_LowMemoryUpdate,BT_LowMemoryPrint,BT_LowMemoryRemove,BT_LowMemoryPriority,BT_LowMemoryExit,NULL);
  1035.  
  1036.          SetCloseRequest (WI_LowMemory,ID_LOWMEMORYEXIT);
  1037.          SetListActive (lowmemorylist,ID_LOWMEMORYLV_ACTIVE);
  1038.  
  1039.          ShowLowMemory();
  1040.  
  1041.          SetWindowOpen (WI_LowMemory,lowmemorylist,ID_LOWMEMORYEXIT);
  1042.       }
  1043.    } else if ((! state) && (WI_LowMemory)) {
  1044.       SetWindowClose (WI_LowMemory,TRUE);
  1045.  
  1046.       FreeLowMemory();
  1047.  
  1048.       DoMethod (AP_Scout,OM_REMMEMBER,WI_LowMemory);
  1049.       MUI_DisposeObject (WI_LowMemory);
  1050.       WI_LowMemory = NULL;
  1051.       lowmemorylist = NULL;
  1052.    }
  1053. }
  1054.  
  1055.  
  1056.  
  1057.  
  1058. char timer_title[WINDOWTITLELEN];
  1059.  
  1060. void TimerWindow (BOOL state) {
  1061.    if (state) {
  1062.       if (WI_Timer) {
  1063.          ShowTimer();
  1064.       } else {
  1065.          WI_Timer = WindowObject,
  1066.          MUIA_Window_Title, MyGetWindowTitle (timer_title, "TIMER REQUESTS"),
  1067.          MUIA_HelpNode, TimerText,
  1068.          MUIA_Window_ID, MakeListID('T','I','M','R'),
  1069.          WindowContents, VGroup,
  1070.             Child, timerlist = MyListviewObject ("DELTA=8,DELTA=8,DELTA=8 P=\33r,DELTA=8 P=\33c,",&timerlist_dsphook),
  1071.             Child, MyBelowListview (&timertext, &timercount),
  1072.             Child, MyVSpace(2),
  1073.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  1074.                Child, BT_TimerUpdate    = KeyButtonA (UpdateText  ,ID_TIMERUPDATE),
  1075.                Child, BT_TimerPrint     = KeyButtonA (PrintText   ,ID_TIMERPRINT),
  1076. //*               Child, BT_TimerRemove    = KeyButtonA (RemoveText  ,ID_TIMERREMOVE),
  1077.                Child, BT_TimerExit      = KeyButtonA (ExitText    ,ID_TIMEREXIT),
  1078.             End,
  1079.          End, End;
  1080.  
  1081.          set(timerlist,MUIA_List_CompareHook,&list_cmpaddresshook);
  1082.  
  1083.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Timer);
  1084.          DoMethod (WI_Timer,MUIM_Window_SetCycleChain,timerlist,BT_TimerUpdate,BT_TimerPrint,BT_TimerExit,NULL);
  1085.  
  1086.          SetCloseRequest (WI_Timer,ID_TIMEREXIT);
  1087.          SetListActive (timerlist,ID_TIMERLV_ACTIVE);
  1088.  
  1089.          ShowTimer();
  1090.  
  1091.          SetWindowOpen (WI_Timer,timerlist,ID_TIMEREXIT);
  1092.       }
  1093.    } else if ((! state) && (WI_Timer)) {
  1094.       SetWindowClose (WI_Timer,TRUE);
  1095.  
  1096.       FreeTimer();
  1097.  
  1098.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Timer);
  1099.       MUI_DisposeObject (WI_Timer);
  1100.       WI_Timer = NULL;
  1101.       timerlist = NULL;
  1102.    }
  1103. }
  1104.  
  1105.  
  1106. char semaphores_title[WINDOWTITLELEN];
  1107.  
  1108. void SemaphoresWindow (BOOL state) {
  1109.    if (state) {
  1110.       if (WI_Semaphores) {
  1111.          ShowSemaphores();
  1112.       } else {
  1113.          WI_Semaphores = WindowObject,
  1114.          MUIA_Window_Title, MyGetWindowTitle (semaphores_title, "SEMAPHORES"),
  1115.          MUIA_HelpNode, SemaphoresText,
  1116.          MUIA_Window_ID, MakeListID('S','E','M','A'),
  1117.          WindowContents, VGroup,
  1118.             Child, semlist = MyListviewObject ("COL=0 DELTA=8,COL=1 DELTA=8,COL=2 DELTA=8 P=\33r,COL=3 DELTA=8 P=\33r,COL=4 DELTA=8",&semlist_dsphook),
  1119.             Child, MyBelowListview (&semtext, &semcount),
  1120.             Child, MyVSpace(2),
  1121.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  1122.                Child, BT_SemUpdate   = KeyButtonA (UpdateText ,ID_SEMUPDATE),
  1123.                Child, BT_SemPrint    = KeyButtonA (PrintText  ,ID_SEMPRINT),
  1124.                Child, BT_SemObtain   = KeyButtonA (ObtainText ,ID_SEMOBTAIN),
  1125.                Child, BT_SemRelease  = KeyButtonA (ReleaseText,ID_SEMRELEASE),
  1126.                Child, BT_SemRemove   = KeyButtonA (RemoveText ,ID_SEMREMOVE),
  1127.                Child, BT_SemExit     = KeyButtonA (ExitText   ,ID_SEMEXIT),
  1128.             End,
  1129.          End, End;
  1130.  
  1131.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Semaphores);
  1132.          DoMethod (WI_Semaphores,MUIM_Window_SetCycleChain,semlist,BT_SemUpdate,BT_SemPrint,BT_SemObtain,BT_SemRelease,BT_SemRemove,BT_SemExit,NULL);
  1133.  
  1134.          SetCloseRequest (WI_Semaphores,ID_SEMEXIT);
  1135.          SetListActive (semlist,ID_SEMLV_ACTIVE);
  1136.  
  1137.          ShowSemaphores();
  1138.  
  1139.          SetWindowOpen (WI_Semaphores,semlist,ID_SEMEXIT);
  1140.       }
  1141.    } else if ((! state) && (WI_Semaphores)) {
  1142.       SetWindowClose (WI_Semaphores,TRUE);
  1143.  
  1144.       FreeSemaphores();
  1145.  
  1146.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Semaphores);
  1147.       MUI_DisposeObject (WI_Semaphores);
  1148.       WI_Semaphores = NULL;
  1149.       semlist = NULL;
  1150.    }
  1151. }
  1152.  
  1153. char interrupts_title[WINDOWTITLELEN];
  1154.  
  1155. void InterruptsWindow (BOOL state) {
  1156.    if (state) {
  1157.       if (WI_Interrupts) {
  1158.          ShowInterrupts();
  1159.       } else {
  1160.          WI_Interrupts = WindowObject,
  1161.          MUIA_Window_Title, MyGetWindowTitle (interrupts_title, "INTERRUPTS"),
  1162.          MUIA_HelpNode, InterruptsText,
  1163.          MUIA_Window_ID, MakeListID('I','N','T','E'),
  1164.          WindowContents, VGroup,
  1165.             Child, intlist = MyListviewObject ("COL=0 DELTA=8,COL=1 DELTA=8,COL=2 DELTA=8 P=\33r,COL=3 DELTA=8,COL=4 DELTA=8,COL=5 DELTA=8 P=\33r,COL=6",&intlist_dsphook),
  1166.             Child, MyBelowListview (&inttext, &intcount),
  1167.             Child, MyVSpace(2),
  1168.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  1169.                Child, BT_IntUpdate   = KeyButtonA (UpdateText,ID_INTUPDATE),
  1170.                Child, BT_IntPrint    = KeyButtonA (PrintText ,ID_INTPRINT),
  1171.                Child, BT_IntRemove   = KeyButtonA (RemoveText,ID_INTREMOVE),
  1172.                Child, BT_IntMore     = KeyButtonA (MoreText  ,ID_INTMORE),
  1173.                Child, BT_IntExit     = KeyButtonA (ExitText  ,ID_INTEXIT),
  1174.             End,
  1175.          End, End;
  1176.  
  1177.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Interrupts);
  1178.          DoMethod (WI_Interrupts,MUIM_Window_SetCycleChain,intlist,BT_IntUpdate,BT_IntPrint,BT_IntRemove,BT_IntMore,BT_IntExit,NULL);
  1179.  
  1180.          SetCloseRequest (WI_Interrupts,ID_INTEXIT);
  1181.          SetListActive (intlist,ID_INTLV_ACTIVE);
  1182.          SetListviewDoubleClick (intlist,ID_INTMORE);
  1183.  
  1184.          ShowInterrupts();
  1185.  
  1186.          SetWindowOpen (WI_Interrupts,intlist,ID_INTEXIT);
  1187.       }
  1188.    } else if ((! state) && (WI_Interrupts)) {
  1189.       SetWindowClose (WI_Interrupts,TRUE);
  1190.  
  1191.       FreeInterrupts();
  1192.  
  1193.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Interrupts);
  1194.       MUI_DisposeObject (WI_Interrupts);
  1195.       WI_Interrupts = NULL;
  1196.       intlist = NULL;
  1197.    }
  1198. }
  1199.  
  1200. char fonts_title[WINDOWTITLELEN];
  1201.  
  1202. void FontsWindow (BOOL state) {
  1203.    if (state) {
  1204.       if (WI_Fonts) {
  1205.          ShowFonts();
  1206.       } else {
  1207.          WI_Fonts = WindowObject,
  1208.          MUIA_Window_Title, MyGetWindowTitle (fonts_title, "FONTS"),
  1209.          MUIA_HelpNode, FontsText,
  1210.          MUIA_Window_ID, MakeListID('F','O','N','T'),
  1211.          WindowContents, VGroup,
  1212.             Child, fontlist = MyListviewObject ("COL=0 DELTA=8,COL=1 DELTA=8 P=\33r,COL=2 DELTA=8,COL=3 DELTA=8,COL=4 DELTA=8 P=\33r,COL=5 DELTA=8 P=\33r,COL=6 DELTA=8 P=\33r,COL=7 DELTA=8,COL=8",&fontlist_dsphook),
  1213.             Child, MyBelowListview (&fonttext, &fontcount),
  1214.             Child, MyVSpace(2),
  1215.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  1216.                Child, BT_FontUpdate  = KeyButtonA (UpdateText,ID_FONTUPDATE),
  1217.                Child, BT_FontPrint   = KeyButtonA (PrintText ,ID_FONTPRINT),
  1218.                Child, BT_FontClose   = KeyButtonA (CloseText,ID_FONTCLOSE),
  1219.                Child, BT_FontRemove  = KeyButtonA (RemoveText,ID_FONTREMOVE),
  1220.                Child, BT_FontExit    = KeyButtonA (ExitText  ,ID_FONTEXIT),
  1221.             End,
  1222.          End, End;
  1223.  
  1224.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Fonts);
  1225.          DoMethod (WI_Fonts,MUIM_Window_SetCycleChain,fontlist,BT_FontUpdate,BT_FontPrint,BT_FontClose,BT_FontRemove,BT_FontExit,NULL);
  1226.  
  1227.          SetCloseRequest (WI_Fonts,ID_FONTEXIT);
  1228.          SetListActive (fontlist,ID_FONTLV_ACTIVE);
  1229.  
  1230.          ShowFonts();
  1231.  
  1232.          SetWindowOpen (WI_Fonts,fontlist,ID_FONTEXIT);
  1233.       }
  1234.    } else if ((! state) && (WI_Fonts)) {
  1235.       SetWindowClose (WI_Fonts,TRUE);
  1236.  
  1237.       FreeFonts();
  1238.  
  1239.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Fonts);
  1240.       MUI_DisposeObject (WI_Fonts);
  1241.       WI_Fonts = NULL;
  1242.       fontlist = NULL;
  1243.    }
  1244. }
  1245.  
  1246. static const char *CYA_CpuUsageText[] = {
  1247.    "off",
  1248.    "full",
  1249.    " in % ",
  1250.    NULL
  1251. };
  1252.  
  1253. __asm void cpuinterval_callfunc(register __a1 unsigned char **contents) {
  1254.    int      i, j, t;
  1255.    long     micros = NULL;
  1256.    UBYTE    text[8];
  1257.  
  1258.    if ((switchstate) && (*switchstate)) {
  1259.       AbortIO ((struct IORequest *) &TimerIORequest);
  1260.    }
  1261.  
  1262.    strncpy (text, *contents, 6);
  1263.  
  1264.    i = 0;
  1265.    while ((text[i] != '\0') && (text[i] != '.')) {
  1266.       i++;
  1267.    }
  1268.    if (text[i] == '.') {
  1269.       t = 1;
  1270.       text[i] = '\0';
  1271.       while (isdigit (text[++i])) {
  1272.          if (j = (int) (text[i] - '0')) {
  1273.             t *= 10;
  1274.             micros += (1000000 / t) * j;
  1275.          }
  1276.       }
  1277.    }
  1278.    cpumicros = micros;
  1279.    cpuseconds = atol ((char const *) &text);
  1280.    strcpy (updatetimetext,*contents);
  1281.  
  1282.    if ((switchstate) && (*switchstate)) {
  1283.       TimerIORequest.tr_time.tv_secs = cpuseconds;
  1284.       TimerIORequest.tr_time.tv_micro = cpumicros;
  1285.       TimerIORequest.tr_node.io_Command = TR_ADDREQUEST;
  1286.       SendIO ((struct IORequest *) &TimerIORequest);
  1287.    }
  1288. }
  1289.  
  1290. struct Hook cpuinterval_callhook = {
  1291.  {NULL, NULL},
  1292.  (ULONG (* )())cpuinterval_callfunc,
  1293.  NULL, NULL
  1294. };
  1295.  
  1296. /* Beispiel-EditHook aus RKM-Libraries Seite 164 */
  1297. /*
  1298. __asm ULONG realstring_editfunc(register __a0 struct Hook *hook, register __a2 struct SGWork *sgw, register __a1 ULONG *msg) {
  1299.    UBYTE *work_ptr;
  1300.    ULONG return_code;
  1301.  
  1302.    return_code = ~0L;
  1303.  
  1304.    if (*msg == SGH_KEY) {
  1305.       if ((sgw->EditOp == EO_REPLACECHAR) || (sgw->EditOp == EO_INSERTCHAR)) {
  1306.          if (!IsHexDigit (sgw->Code)) {
  1307.             sgw->Actions |= SGA_BEEP;
  1308.             sgw->Actions &= ~SGA_USE;
  1309.          } else {
  1310.             sgw->WorkBuffer[sgw->BufferPos - 1] = ToUpper (sgw->Code);
  1311.          }
  1312.       }
  1313.    } else if (*msg == SGH_CLICK) {
  1314.       if (sgw->BufferPos < sgw->NumChars) {
  1315.          work_ptr = sgw->WorkBuffer + sgw->BufferPos;
  1316.          *work_ptr = '0';
  1317.       }
  1318.    } else {
  1319.       return_code = 0;
  1320.    }
  1321.    return (return_code);
  1322. }
  1323. */
  1324.  
  1325. __asm ULONG hexstring_editfunc (register __a0 struct Hook *hook, register __a2 struct SGWork *sgw, register __a1 ULONG *msg) {
  1326.    ULONG return_code;
  1327.    int   i = 0;
  1328.    char  c;
  1329.  
  1330.    return_code = ~0L;
  1331.  
  1332.    if (*msg == SGH_KEY) {
  1333.       long  tmplong;
  1334.  
  1335.       if ((sgw->EditOp == EO_REPLACECHAR) || (sgw->EditOp == EO_INSERTCHAR)) {
  1336.          if (sgw->WorkBuffer[0] == '$')
  1337.             i = 1;
  1338.          if (! strncmp ("0x", sgw->WorkBuffer, 2))
  1339.             i = 2;
  1340.          while (c = sgw->WorkBuffer[i]) {
  1341.             if ((! ((c >= '0') && (c <= '9'))) \
  1342.               && (! ((c >= 'a') && (c <= 'f'))) \
  1343.               && (! ((c >= 'A') && (c <= 'F')))) {
  1344.                sgw->Actions |= SGA_BEEP;
  1345.                sgw->Actions &= ~SGA_USE;
  1346.                break;
  1347.             }
  1348.             i++;
  1349.          }
  1350.       } else if ((sgw->EditOp == EO_ENTER) && (! IsHex (sgw->WorkBuffer, &tmplong))) { 
  1351.          sgw->Actions |= SGA_BEEP;
  1352.          sgw->Actions &= ~SGA_END;
  1353.       }
  1354.    } else {
  1355.       return_code = 0;
  1356.    }
  1357.    return (return_code);
  1358. }
  1359.  
  1360. struct Hook hexstring_edithook = {
  1361.  {NULL, NULL},
  1362.  (ULONG (* )())hexstring_editfunc,
  1363.  NULL, NULL
  1364. };
  1365.  
  1366. __asm ULONG realstring_editfunc(register __a0 struct Hook *hook, register __a2 struct SGWork *sgw, register __a1 ULONG *msg) {
  1367.    ULONG return_code;
  1368.    int   i = 0,punkte = 0,notzeros = 0;
  1369.  
  1370.    return_code = ~0L;
  1371.  
  1372.    if (*msg == SGH_KEY) {
  1373.       if ((sgw->EditOp == EO_REPLACECHAR) || (sgw->EditOp == EO_INSERTCHAR)) {
  1374.          while (sgw->WorkBuffer[i]) {
  1375.             if (sgw->WorkBuffer[i++] == '.')
  1376.                punkte++;
  1377.          }
  1378.          if ((punkte > 1) || ((!isdigit (sgw->Code)) && (sgw->Code != '.'))) {
  1379.             sgw->Actions |= SGA_BEEP;
  1380.             sgw->Actions &= ~SGA_USE;
  1381.          }
  1382.       } else if (sgw->EditOp == EO_ENTER) {
  1383.          while (sgw->WorkBuffer[i]) {
  1384.             if ((sgw->WorkBuffer[i] >= '1') && (sgw->WorkBuffer[i] <= '9'))
  1385.                notzeros++;
  1386.             i++;
  1387.          }
  1388.          if ((sgw->EditOp == EO_ENTER) && (!notzeros)) { 
  1389.             sgw->Actions |= SGA_BEEP;
  1390.             sgw->Actions &= ~SGA_END;
  1391.          }
  1392.       }
  1393.    } else {
  1394.       return_code = 0;
  1395.    }
  1396.    return (return_code);
  1397. }
  1398.  
  1399. struct Hook realstring_edithook = {
  1400.  {NULL, NULL},
  1401.  (ULONG (* )())realstring_editfunc,
  1402.  NULL, NULL
  1403. };
  1404.  
  1405. APTR TaskSortList[] = {
  1406.    &tasklist_cmpaddresshook,
  1407.    &list_cmpnamehook,
  1408.    &tasklist_cmpprihook,
  1409.    NULL
  1410. };
  1411.  
  1412. static const char *CYA_TaskSortText[] = {
  1413.    "address",
  1414.    "name",
  1415.    "priority",
  1416.    NULL
  1417. };
  1418.  
  1419. APTR WI_Tasks, tasklist, tasktext, tasktext2, taskcount, CY_TaskSort;
  1420. int  tasksortstate = 0;
  1421. APTR BT_TaskPrint, BT_TaskFreeze, BT_TaskActivate, cpucount, CY_CpuUsage;
  1422. APTR BT_TaskUpdate, BT_TaskRemove, BT_TaskSignal, BT_TaskBreak, BT_TaskPriority, BT_TaskMore, BT_TaskExit;
  1423.  
  1424. char tasks_title[WINDOWTITLELEN];
  1425.  
  1426. void TasksWindow (BOOL state) {
  1427.    if (state) {
  1428.       if (WI_Tasks) {
  1429.          ShowTasks();
  1430.       } else {
  1431.          WI_Tasks = WindowObject,
  1432.          MUIA_Window_Title, MyGetWindowTitle (tasks_title, "TASKS"),
  1433.          MUIA_HelpNode, TasksText,
  1434.          MUIA_Window_ID, MakeListID('T','A','S','K'),
  1435.          WindowContents, VGroup,
  1436.             Child, tasklist = MyListviewObject ("COL=0 DELTA=8,COL=1 DELTA=8 P=\33c,COL=2 DELTA=8 P=\33r,COL=3 DELTA=8 P=\33r,COL=4 DELTA=8 P=\33c,COL=5 DELTA=8,COL=6 DELTA=8 P=\33r,COL=7",&tasklist_dsphook),
  1437.             Child, MyBelowSortedListview (&tasktext, &taskcount, &CY_TaskSort, CYA_TaskSortText, tasksortstate),
  1438.             Child, MyVSpace(2),
  1439.             Child, VGroup,
  1440.                Child, HGroup, MUIA_Group_SameSize, TRUE,
  1441.                   Child, BT_TaskPrint    = KeyButtonA (PrintText   ,ID_TASKPRINT),
  1442.                   Child, BT_TaskFreeze   = KeyButtonA (FreezeText  ,ID_TASKFREEZE),
  1443.                   Child, BT_TaskActivate = KeyButtonA (ActivateText,ID_TASKACTIVATE),
  1444.                   Child, HGroup,
  1445.                      Child, MyLabel2 (" CPU:"),
  1446. //*                     Child, cpucount = MyTextObject3(ESC "c-----"),
  1447.                      Child, cpucount = GaugeObject,
  1448.                        MUIA_Frame         , MUIV_Frame_Gauge,
  1449.                        MUIA_Gauge_Horiz   , TRUE,
  1450.                        MUIA_Gauge_Max     , 100,
  1451.                        MUIA_Gauge_InfoText, "\0330-----",
  1452.                        MUIA_Gauge_Current , 0,
  1453.                      End,
  1454.                   End,
  1455.                   Child, CY_CpuUsage = CycleObject,
  1456.                      MUIA_Weight, 0,
  1457.                      MUIA_Cycle_Entries, CYA_CpuUsageText,
  1458.                      MUIA_Cycle_Active, updatetimestate,
  1459.                   End,
  1460.                   Child, HGroup,
  1461.                      Child, MyLabel2 (" Secs:"),
  1462.                      Child, tasktext2 = StringObject,
  1463.                         MUIA_String_BufferPos, 1,
  1464.                         MUIA_String_MaxLen, 6, StringFrame,
  1465.                         MUIA_String_EditHook, &realstring_edithook,
  1466.                         MUIA_String_Contents, updatetimetext,
  1467.                      End,
  1468.                   End,
  1469.                End,
  1470.                Child, HGroup, MUIA_Group_SameSize, TRUE,
  1471.                   Child, BT_TaskUpdate   = KeyButtonA (UpdateText  ,ID_TASKUPDATE),
  1472.                   Child, BT_TaskRemove   = KeyButtonA (RemoveText  ,ID_TASKREMOVE),
  1473.                   Child, BT_TaskSignal   = KeyButtonA (SignalText  ,ID_TASKSIGNAL),
  1474.                   Child, BT_TaskBreak    = KeyButtonA (BreakText   ,ID_TASKBREAK),
  1475.                   Child, BT_TaskPriority = KeyButtonA (PriorityText,ID_TASKPRIORITY),
  1476.                   Child, BT_TaskMore     = KeyButtonA (MoreText    ,ID_TASKMORE),
  1477.                   Child, BT_TaskExit     = KeyButtonA (ExitText    ,ID_TASKEXIT),
  1478.                End,
  1479.             End,
  1480.          End, End;
  1481.  
  1482.          if (WI_Tasks) {
  1483.             DoMethod (AP_Scout,OM_ADDMEMBER,WI_Tasks);
  1484.             DoMethod (WI_Tasks,MUIM_Window_SetCycleChain,tasklist,CY_TaskSort,BT_TaskPrint,BT_TaskFreeze,BT_TaskActivate,CY_CpuUsage,tasktext2,BT_TaskUpdate,BT_TaskRemove,BT_TaskSignal,BT_TaskBreak,BT_TaskPriority,BT_TaskMore,BT_TaskExit,NULL);
  1485.             DoMethod (CY_CpuUsage, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, AP_Scout, 2, MUIM_Application_ReturnID, ID_CPUUSAGE);
  1486.             DoMethod (CY_TaskSort, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, AP_Scout, 2, MUIM_Application_ReturnID, ID_TASKSORT);
  1487.             DoMethod (tasktext2,MUIM_Notify,MUIA_String_Acknowledge,MUIV_EveryTime,tasktext2,3,MUIM_CallHook,&cpuinterval_callhook,MUIV_TriggerValue);
  1488.  
  1489.             SetCloseRequest (WI_Tasks,ID_TASKEXIT);
  1490.             SetListActive (tasklist,ID_TASKLV_ACTIVE);
  1491.             SetListviewDoubleClick (tasklist,ID_TASKMORE);
  1492.  
  1493.             ShowTasks();
  1494.  
  1495.             SetWindowOpen (WI_Tasks,tasklist,ID_TASKEXIT);
  1496.  
  1497.             if (updatetimestate)
  1498.                CheckCPUUsage();
  1499.          }
  1500.       }
  1501.    } else if ((! state) && (WI_Tasks)) {
  1502.       if (patchsem)
  1503.          *switchstate = FALSE;
  1504.  
  1505.       if (cheattask)
  1506.          RemoveCheatTask();
  1507.  
  1508.       SetWindowClose (WI_Tasks,TRUE);
  1509.  
  1510.       FreeTasks();
  1511.  
  1512.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Tasks);
  1513.       MUI_DisposeObject (WI_Tasks);
  1514.       WI_Tasks = NULL;
  1515.       tasklist = NULL;
  1516.    }
  1517. }
  1518.  
  1519. APTR CxSortList[] = {
  1520.    &cxlist_cmpaddresshook,
  1521.    &cxlist_cmpnamehook,
  1522.    &cxlist_cmpprihook,
  1523.    NULL
  1524. };
  1525.  
  1526. static const char *CYA_CxSortText[] = {
  1527.    "address",
  1528.    "name",
  1529.    "priority",
  1530.    NULL
  1531. };
  1532.  
  1533. APTR WI_Cx, cxlist, cxtext, cxcount, CY_CxSort;
  1534. int  cxsortstate = 0;
  1535. APTR BT_CxAppear, BT_CxDisappear, BT_CxEnable, BT_CxDisable, BT_CxKill, BT_CxListChg, BT_CxUnique;
  1536. APTR BT_CxUpdate, BT_CxPrint, BT_CxPriority, BT_CxRemove, BT_CxMore, BT_CxExit;
  1537.  
  1538. char cx_title[WINDOWTITLELEN];
  1539.  
  1540. void CxWindow (BOOL state) {
  1541.    if (state) {
  1542.       if (WI_Cx) {
  1543.          ShowCx();
  1544.       } else {
  1545.          WI_Cx = WindowObject,
  1546.          MUIA_Window_Title, MyGetWindowTitle (cx_title, "COMMODITIES"),
  1547.          MUIA_HelpNode, CommoditiesText,
  1548.          MUIA_Window_ID, MakeListID('C','D','I','T'),
  1549.          WindowContents, VGroup,
  1550.             Child, cxlist = MyListviewObject ("DELTA=8,DELTA=8 P=\33c,DELTA=8 P=\33c,DELTA=8 P=\33c,DELTA=8,",&cxlist_dsphook),
  1551.             Child, MyBelowSortedListview (&cxtext, &cxcount, &CY_CxSort, CYA_CxSortText, cxsortstate),
  1552.             Child, MyVSpace(2),
  1553.             Child, VGroup,
  1554.                Child, HGroup, MUIA_Group_SameSize, TRUE,
  1555.                   Child, BT_CxAppear     = KeyButtonA (AppearText   ,ID_CXAPPEAR),
  1556.                   Child, BT_CxDisappear  = KeyButtonA (DisappearText,ID_CXDISAPPEAR),
  1557.                   Child, BT_CxEnable     = KeyButtonA (EnableText   ,ID_CXENABLE),
  1558.                   Child, BT_CxDisable    = KeyButtonA (DisableText  ,ID_CXDISABLE),
  1559.                   Child, BT_CxKill       = KeyButtonA (KillText     ,ID_CXKILL),
  1560.                   Child, BT_CxListChg    = KeyButtonA (ListChgText  ,ID_CXLISTCHG),
  1561.                   Child, BT_CxUnique     = KeyButtonA (UniqueText   ,ID_CXUNIQUE),
  1562.                End,
  1563.                Child, HGroup, MUIA_Group_SameSize, TRUE,
  1564.                   Child, BT_CxUpdate     = KeyButtonA (UpdateText   ,ID_CXUPDATE),
  1565.                   Child, BT_CxPrint      = KeyButtonA (PrintText    ,ID_CXPRINT),
  1566.                   Child, BT_CxPriority   = KeyButtonA (PriorityText ,ID_CXPRIORITY),
  1567.                   Child, BT_CxRemove     = KeyButtonA (RemoveText   ,ID_CXREMOVE),
  1568.                   Child, BT_CxMore       = KeyButtonA (MoreText     ,ID_CXMORE),
  1569.                   Child, BT_CxExit       = KeyButtonA (ExitText     ,ID_CXEXIT),
  1570.                End,
  1571.             End,
  1572.          End, End;
  1573.  
  1574.          if (WI_Cx) {
  1575.             DoMethod (AP_Scout,OM_ADDMEMBER,WI_Cx);
  1576.             DoMethod (WI_Cx,MUIM_Window_SetCycleChain,cxlist,CY_CxSort,BT_CxAppear,BT_CxDisappear,BT_CxEnable,BT_CxDisable,BT_CxKill,BT_CxListChg,BT_CxUnique,BT_CxUpdate,BT_CxPrint,BT_CxPriority,BT_CxRemove,BT_CxMore,BT_CxExit,NULL);
  1577.             DoMethod (CY_CxSort, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, AP_Scout, 2, MUIM_Application_ReturnID, ID_CXSORT);
  1578.  
  1579.             SetCloseRequest (WI_Cx,ID_CXEXIT);
  1580.             SetListActive (cxlist,ID_CXLV_ACTIVE);
  1581.             SetListviewDoubleClick (cxlist,ID_CXMORE);
  1582.  
  1583.             ShowCx();
  1584.  
  1585.             SetWindowOpen (WI_Cx,cxlist,ID_CXEXIT);
  1586.          }
  1587.       }
  1588.    } else if ((! state) && (WI_Cx)) {
  1589.       SetWindowClose (WI_Cx,TRUE);
  1590.       FreeCx();
  1591.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Cx);
  1592.       MUI_DisposeObject (WI_Cx);
  1593.       WI_Cx = NULL;
  1594.       cxlist = NULL;
  1595.    }
  1596. }
  1597.  
  1598.  
  1599. APTR ClassSortList[] = {
  1600.    &classlist_cmpaddresshook,
  1601.    &classlist_cmpnamehook,
  1602.    &classlist_cmpsuperhook,
  1603.    NULL
  1604. };
  1605.  
  1606. static const char *CYA_ClassSortText[] = {
  1607.    "address",
  1608.    "name",
  1609.    "superclass",
  1610.    NULL
  1611. };
  1612.  
  1613. APTR WI_Class, classlist, classtext, classcount, CY_ClassSort;
  1614. int  classsortstate = 0;
  1615. APTR BT_ClassUpdate, BT_ClassPrint, BT_ClassRemove, BT_ClassMore, BT_ClassExit;
  1616.  
  1617. char class_title[WINDOWTITLELEN];
  1618.  
  1619. void ClassWindow (BOOL state) {
  1620.    if (state) {
  1621.       if (WI_Class) {
  1622.          ShowClass();
  1623.       } else {
  1624.          WI_Class = WindowObject,
  1625.          MUIA_Window_Title, MyGetWindowTitle (cx_title, "CLASSES"),
  1626.          MUIA_HelpNode, ClassesText,
  1627.          MUIA_Window_ID, MakeListID('C','L','A','S'),
  1628.          WindowContents, VGroup,
  1629.             Child, classlist = MyListviewObject ("DELTA=8,DELTA=8,DELTA=8,DELTA=8,DELTA=8,",&classlist_dsphook),
  1630.             Child, MyBelowSortedListview (&classtext, &classcount, &CY_ClassSort, CYA_ClassSortText, classsortstate),
  1631.             Child, MyVSpace(2),
  1632.             Child, VGroup,
  1633.                Child, HGroup, MUIA_Group_SameSize, TRUE,
  1634.                   Child, BT_ClassUpdate     = KeyButtonA (UpdateText   ,ID_CLASSUPDATE),
  1635.                   Child, BT_ClassPrint      = KeyButtonA (PrintText    ,ID_CLASSPRINT),
  1636.                   Child, BT_ClassRemove     = KeyButtonA (RemoveText   ,ID_CLASSREMOVE),
  1637.                   Child, BT_ClassMore       = KeyButtonA (MoreText     ,ID_CLASSMORE),
  1638.                   Child, BT_ClassExit       = KeyButtonA (ExitText     ,ID_CLASSEXIT),
  1639.                End,
  1640.             End,
  1641.          End, End;
  1642.  
  1643.          if (WI_Class) {
  1644.             DoMethod (AP_Scout,OM_ADDMEMBER,WI_Class);
  1645.             DoMethod (WI_Class,MUIM_Window_SetCycleChain,classlist,CY_ClassSort,BT_ClassUpdate,BT_ClassPrint,BT_ClassRemove,BT_ClassMore,BT_ClassExit,NULL);
  1646.             DoMethod (CY_ClassSort, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, AP_Scout, 2, MUIM_Application_ReturnID, ID_CLASSSORT);
  1647.  
  1648.             SetCloseRequest (WI_Class,ID_CLASSEXIT);
  1649.             SetListActive (classlist,ID_CLASSLV_ACTIVE);
  1650.             SetListviewDoubleClick (classlist,ID_CLASSMORE);
  1651.  
  1652.             ShowClass();
  1653.  
  1654.             SetWindowOpen (WI_Class,classlist,ID_CLASSEXIT);
  1655.          }
  1656.       }
  1657.    } else if ((! state) && (WI_Class)) {
  1658.       SetWindowClose (WI_Class,TRUE);
  1659.       FFreeClass();
  1660.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Class);
  1661.       MUI_DisposeObject (WI_Class);
  1662.       WI_Class = NULL;
  1663.       classlist = NULL;
  1664.    }
  1665. }
  1666.  
  1667. APTR SModeSortList[] = {
  1668.    &smodelist_cmpidhook,
  1669.    &smodelist_cmpnamehook,
  1670.    &smodelist_cmpreshook,
  1671.    NULL
  1672. };
  1673.  
  1674. static const char *CYA_SModeSortText[] = {
  1675.    "ModeID",
  1676.    "name",
  1677.    "resolution",
  1678.    NULL
  1679. };
  1680.  
  1681. APTR WI_SMode, smodelist, smodetext, smodecount, CY_SModeSort;
  1682. int  smodesortstate = 0;
  1683. APTR BT_SModeUpdate, BT_SModePrint, BT_SModeMore, BT_SModeExit;
  1684.  
  1685. char smode_title[WINDOWTITLELEN];
  1686.  
  1687. void SModeWindow (BOOL state) {
  1688.    if (state) {
  1689.       if (WI_SMode) {
  1690.          ShowSMode();
  1691.       } else {
  1692.          WI_SMode = WindowObject,
  1693.          MUIA_Window_Title, MyGetWindowTitle (smode_title, "SCREENMODE"),
  1694.          MUIA_HelpNode, ScreenModeText,
  1695.          MUIA_Window_ID, MakeListID('S','M','D','E'),
  1696.          WindowContents, VGroup,
  1697.             Child, smodelist = MyListviewObject ("DELTA=8,DELTA=8,DELTA=8,DELTA=8,",&smodelist_dsphook),
  1698.             Child, MyBelowSortedListview (&smodetext, &smodecount, &CY_SModeSort, CYA_SModeSortText, smodesortstate),
  1699.             Child, MyVSpace(2),
  1700.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  1701.                Child, BT_SModeUpdate     = KeyButtonA (UpdateText   ,ID_SMODEUPDATE),
  1702.                Child, BT_SModePrint      = KeyButtonA (PrintText    ,ID_SMODEPRINT),
  1703.                Child, BT_SModeMore       = KeyButtonA (MoreText     ,ID_SMODEMORE),
  1704.                Child, BT_SModeExit       = KeyButtonA (ExitText     ,ID_SMODEEXIT),
  1705.             End,
  1706.          End, End;
  1707.  
  1708.          if (WI_SMode) {
  1709.             DoMethod (AP_Scout,OM_ADDMEMBER,WI_SMode);
  1710.             DoMethod (WI_SMode,MUIM_Window_SetCycleChain,smodelist,CY_SModeSort,BT_SModeUpdate,BT_SModePrint,BT_SModeMore,BT_SModeExit,NULL);
  1711.             DoMethod (CY_SModeSort, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, AP_Scout, 2, MUIM_Application_ReturnID, ID_SMODESORT);
  1712.  
  1713.             SetCloseRequest (WI_SMode,ID_SMODEEXIT);
  1714.             SetListActive (smodelist,ID_SMODELV_ACTIVE);
  1715.             SetListviewDoubleClick (smodelist,ID_SMODEMORE);
  1716.  
  1717.             ShowSMode();
  1718.  
  1719.             SetWindowOpen (WI_SMode,smodelist,ID_SMODEEXIT);
  1720.          }
  1721.       }
  1722.    } else if ((! state) && (WI_SMode)) {
  1723.       SetWindowClose (WI_SMode,TRUE);
  1724.       FreeSMode();
  1725.       DoMethod (AP_Scout,OM_REMMEMBER,WI_SMode);
  1726.       MUI_DisposeObject (WI_SMode);
  1727.       WI_SMode = NULL;
  1728.       smodelist = NULL;
  1729.    }
  1730. }
  1731.  
  1732. APTR LibSortList[] = {
  1733.    &list_cmpnormalhook,
  1734.    &list_cmpnamehook,
  1735.    &list_cmpaddresshook,
  1736.    NULL
  1737. };
  1738.  
  1739. static const char *CYA_LibSortText[] = {
  1740.    "priority",
  1741.    "name",
  1742.    "address",
  1743.    NULL
  1744. };
  1745.  
  1746. APTR WI_Libraries, liblist, libtext, libcount, CY_LibSort;
  1747. int  libsortstate = 0;
  1748. APTR BT_LibUpdate, BT_LibPrint, BT_LibPriority, BT_LibClose, BT_LibRemove, BT_LibFunctions, BT_LibMore, BT_LibExit;
  1749.  
  1750. char libraries_title[WINDOWTITLELEN];
  1751.  
  1752. void LibrariesWindow (BOOL state) {
  1753.    if (state) {
  1754.       if (WI_Libraries) {
  1755.          ShowLibraries();
  1756.       } else {
  1757.          WI_Libraries = WindowObject,
  1758.          MUIA_Window_Title, MyGetWindowTitle (libraries_title, "LIBRARIES"),
  1759.          MUIA_HelpNode, LibrariesText,
  1760.          MUIA_Window_ID, MakeListID('L','I','B','S'),
  1761.          WindowContents, VGroup,
  1762.             Child, liblist = MyListviewObject (LibDevResFormatText,&liblist_dsphook),
  1763.             Child, MyBelowSortedListview (&libtext, &libcount, &CY_LibSort, CYA_LibSortText, libsortstate),
  1764.             Child, MyVSpace(2),
  1765.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  1766.                Child, BT_LibPriority  = KeyButtonA (PriorityText ,ID_LIBPRIORITY),
  1767.                Child, BT_LibClose     = KeyButtonA (CloseText    ,ID_LIBCLOSE),
  1768.                Child, BT_LibRemove    = KeyButtonA (RemoveText   ,ID_LIBREMOVE),
  1769.                Child, BT_LibFunctions = KeyButtonA (FunctionsText,ID_LIBFUNCTIONS),
  1770.             End,
  1771.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  1772.                Child, BT_LibUpdate    = KeyButtonA (UpdateText  ,ID_LIBUPDATE),
  1773.                Child, BT_LibPrint     = KeyButtonA (PrintText   ,ID_LIBPRINT),
  1774.                Child, BT_LibMore      = KeyButtonA (MoreText    ,ID_LIBMORE),
  1775.                Child, BT_LibExit      = KeyButtonA (ExitText    ,ID_LIBEXIT),
  1776.             End,
  1777.          End, End;
  1778.  
  1779.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Libraries);
  1780.          DoMethod (WI_Libraries,MUIM_Window_SetCycleChain,liblist,CY_LibSort,BT_LibUpdate,BT_LibPrint,BT_LibPriority,BT_LibClose,BT_LibRemove,BT_LibFunctions,BT_LibMore,BT_LibExit,NULL);
  1781.          DoMethod (CY_LibSort, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, AP_Scout, 2, MUIM_Application_ReturnID, ID_LIBSORT);
  1782.  
  1783.          SetCloseRequest (WI_Libraries,ID_LIBEXIT);
  1784.          SetListActive (liblist,ID_LIBLV_ACTIVE);
  1785.          SetListviewDoubleClick (liblist,ID_LIBMORE);
  1786.  
  1787.          ShowLibraries();
  1788.  
  1789.          SetWindowOpen (WI_Libraries,liblist,ID_LIBEXIT);
  1790.       }
  1791.    } else if ((! state) && (WI_Libraries)) {
  1792.       SetWindowClose (WI_Libraries,TRUE);
  1793.  
  1794.       FreeLibraries();
  1795.  
  1796.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Libraries);
  1797.       MUI_DisposeObject (WI_Libraries);
  1798.       WI_Libraries = NULL;
  1799.       liblist = NULL;
  1800.    }
  1801. }
  1802.  
  1803. APTR WI_Devices, devlist, devtext, devcount, CY_DevSort;
  1804. int  devsortstate = 0;
  1805. APTR BT_DevUpdate, BT_DevPrint, BT_DevPriority, BT_DevRemove, BT_DevFunctions, BT_DevMore, BT_DevExit;
  1806.  
  1807. char devices_title[WINDOWTITLELEN];
  1808.  
  1809. void DevicesWindow (BOOL state) {
  1810.    if (state) {
  1811.       if (WI_Devices) {
  1812.          ShowDevices();
  1813.       } else {
  1814.          WI_Devices = WindowObject,
  1815.          MUIA_Window_Title, MyGetWindowTitle (devices_title, "DEVICES"),
  1816.          MUIA_HelpNode, DevicesText,
  1817.          MUIA_Window_ID, MakeListID('D','E','V','S'),
  1818.          WindowContents, VGroup,
  1819.             Child, devlist = MyListviewObject (LibDevResFormatText,&liblist_dsphook),
  1820.             Child, MyBelowSortedListview (&devtext, &devcount, &CY_DevSort, CYA_LibSortText, devsortstate),
  1821.             Child, MyVSpace(2),
  1822.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  1823.                Child, BT_DevPriority  = KeyButtonA (PriorityText ,ID_DEVPRIORITY),
  1824.                Child, BT_DevRemove    = KeyButtonA (RemoveText   ,ID_DEVREMOVE),
  1825.                Child, BT_DevFunctions = KeyButtonA (FunctionsText,ID_DEVFUNCTIONS),
  1826.             End,
  1827.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  1828.                Child, BT_DevUpdate    = KeyButtonA (UpdateText   ,ID_DEVUPDATE),
  1829.                Child, BT_DevPrint     = KeyButtonA (PrintText    ,ID_DEVPRINT),
  1830.                Child, BT_DevMore      = KeyButtonA (MoreText     ,ID_DEVMORE),
  1831.                Child, BT_DevExit      = KeyButtonA (ExitText     ,ID_DEVEXIT),
  1832.             End,
  1833.          End, End;
  1834.  
  1835.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Devices);
  1836.          DoMethod (WI_Devices,MUIM_Window_SetCycleChain,devlist,CY_DevSort,BT_DevUpdate,BT_DevPrint,BT_DevPriority,BT_DevRemove,BT_DevMore,BT_DevFunctions,BT_DevExit,NULL);
  1837.          DoMethod (CY_DevSort, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, AP_Scout, 2, MUIM_Application_ReturnID, ID_DEVSORT);
  1838.  
  1839.          SetCloseRequest (WI_Devices,ID_DEVEXIT);
  1840.          SetListActive (devlist,ID_DEVLV_ACTIVE);
  1841.          SetListviewDoubleClick (devlist,ID_DEVMORE);
  1842.  
  1843.          ShowDevices();
  1844.  
  1845.          SetWindowOpen (WI_Devices,devlist,ID_DEVEXIT);
  1846.       }
  1847.    } else if ((! state) && (WI_Devices)) {
  1848.       SetWindowClose (WI_Devices,TRUE);
  1849.  
  1850.       FreeDevices();
  1851.  
  1852.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Devices);
  1853.       MUI_DisposeObject (WI_Devices);
  1854.       WI_Devices = NULL;
  1855.       devlist = NULL;
  1856.    }
  1857. }
  1858.  
  1859. APTR WI_Resources, reslist, restext, rescount, CY_ResSort;
  1860. int  ressortstate = 0;
  1861. APTR BT_ResUpdate, BT_ResPrint, BT_ResPriority, BT_ResRemove, BT_ResFunctions, BT_ResMore, BT_ResExit;
  1862.  
  1863. char resources_title[WINDOWTITLELEN];
  1864.  
  1865. void ResourcesWindow (BOOL state) {
  1866.    if (state) {
  1867.       if (WI_Resources) {
  1868.          ShowResources();
  1869.       } else {
  1870.          WI_Resources = WindowObject,
  1871.          MUIA_Window_Title, MyGetWindowTitle (resources_title, "RESOURCES"),
  1872.          MUIA_HelpNode, ResourcesText,
  1873.          MUIA_Window_ID, MakeListID('R','E','S','O'),
  1874.          WindowContents, VGroup,
  1875.             Child, reslist = MyListviewObject (LibDevResFormatText,&liblist_dsphook),
  1876.             Child, MyBelowSortedListview (&restext, &rescount, &CY_ResSort, CYA_LibSortText, ressortstate),
  1877.             Child, MyVSpace(2),
  1878.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  1879.                Child, BT_ResPriority  = KeyButtonA (PriorityText ,ID_RESPRIORITY),
  1880.                Child, BT_ResRemove    = KeyButtonA (RemoveText   ,ID_RESREMOVE),
  1881.                Child, BT_ResFunctions = KeyButtonA (FunctionsText,ID_RESFUNCTIONS),
  1882.             End,
  1883.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  1884.                Child, BT_ResUpdate    = KeyButtonA (UpdateText   ,ID_RESUPDATE),
  1885.                Child, BT_ResPrint     = KeyButtonA (PrintText    ,ID_RESPRINT),
  1886.                Child, BT_ResMore      = KeyButtonA (MoreText     ,ID_RESMORE),
  1887.                Child, BT_ResExit      = KeyButtonA (ExitText     ,ID_RESEXIT),
  1888.             End,
  1889.          End, End;
  1890.  
  1891.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Resources);
  1892.          DoMethod (WI_Resources,MUIM_Window_SetCycleChain,reslist,CY_ResSort,BT_ResUpdate,BT_ResPrint,BT_ResPriority,BT_ResRemove,BT_ResFunctions,BT_ResMore,BT_ResExit,NULL);
  1893.          DoMethod (CY_ResSort, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, AP_Scout, 2, MUIM_Application_ReturnID, ID_RESSORT);
  1894.  
  1895.          SetCloseRequest (WI_Resources,ID_RESEXIT);
  1896.          SetListActive (reslist,ID_RESLV_ACTIVE);
  1897.          SetListviewDoubleClick (reslist,ID_RESMORE);
  1898.  
  1899.          ShowResources();
  1900.  
  1901.          SetWindowOpen (WI_Resources,reslist,ID_RESEXIT);
  1902.       }
  1903.    } else if ((! state) && (WI_Resources)) {
  1904.       SetWindowClose (WI_Resources,TRUE);
  1905.  
  1906.       FreeResources();
  1907.  
  1908.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Resources);
  1909.       MUI_DisposeObject (WI_Resources);
  1910.       WI_Resources = NULL;
  1911.       reslist = NULL;
  1912.    }
  1913. }
  1914.  
  1915. APTR WI_Locks, locklist, locktext, lockcount, CY_LockSort;
  1916. int  locksortstate = 0;
  1917. APTR lockpattern,locktext2;
  1918. APTR BT_LockUpdate, BT_LockPrint, BT_LockRemove, BT_LockExit;
  1919.  
  1920. APTR LockSortList[] = {
  1921.    &list_cmpnormalhook,
  1922.    &locklist_cmppathhook,
  1923.    &list_cmpaddresshook,
  1924.    NULL
  1925. };
  1926.  
  1927. static const char *CYA_LockSortText[] = {
  1928.    "normal",
  1929.    "path",
  1930.    "address",
  1931.    NULL
  1932. };
  1933.  
  1934. char locks_title[WINDOWTITLELEN];
  1935.  
  1936. void LocksWindow (BOOL state) {
  1937.    if (state) {
  1938.       if (WI_Locks) {
  1939.          ShowLocks();
  1940.       } else {
  1941.          WI_Locks = WindowObject,
  1942.          MUIA_Window_Title, MyGetWindowTitle (locks_title, "LOCKS"),
  1943.          MUIA_HelpNode, LocksText,
  1944.          MUIA_Window_ID, MakeListID('L','O','C','K'),
  1945.          WindowContents, VGroup,
  1946.             Child, locklist = ListviewObject,
  1947.                MUIA_Listview_MultiSelect, TRUE,
  1948.                MUIA_Listview_List, ListObject,
  1949.                MUIA_List_Format, "COL=0 DELTA=8,COL=1 DELTA=8 P=\33c,COL=2",
  1950.                MUIA_List_Title, TRUE,
  1951.                MUIA_List_DisplayHook, &locklist_dsphook,
  1952.                InputListFrame,
  1953.             End, End,
  1954.             Child, HGroup,
  1955.                Child, locktext = MyTextObject5(SPACE40),
  1956.                Child, HGroup, MUIA_HorizWeight, 0,
  1957.                   Child, MyLabel ("sorted by:"),
  1958.                   Child, CY_LockSort = CycleObject,
  1959.                      MUIA_Cycle_Entries, CYA_LockSortText,
  1960.                      MUIA_Cycle_Active, locksortstate,
  1961.                      MUIA_HorizWeight, 0,
  1962.                   End,
  1963.                End,
  1964.             End,
  1965.             Child, locktext2 = MyTextObject(),
  1966.             Child, HGroup,
  1967.                Child, KeyLabel("Pattern:", 'p'),
  1968.                Child, lockpattern = StringObject,
  1969.                   MUIA_String_Contents, "#?", MUIA_ControlChar, 'p',
  1970.                   MUIA_String_MaxLen, TEXTLENGTH, StringFrame,
  1971.                End,
  1972.             End,
  1973.             Child, MyVSpace(2),
  1974.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  1975.                Child, BT_LockUpdate   = KeyButtonA (UpdateText,ID_LOCKUPDATE),
  1976.                Child, BT_LockPrint    = KeyButtonA (PrintText ,ID_LOCKPRINT),
  1977.                Child, BT_LockRemove   = KeyButtonA (RemoveText,ID_LOCKREMOVE),
  1978.                Child, BT_LockExit     = KeyButtonA (ExitText  ,ID_LOCKEXIT),
  1979.             End,
  1980.          End, End;
  1981.  
  1982.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Locks);
  1983.          DoMethod (WI_Locks,MUIM_Window_SetCycleChain,locklist,CY_LockSort,lockpattern,BT_LockUpdate,BT_LockPrint,BT_LockRemove,BT_LockExit,NULL);
  1984.          DoMethod (CY_LockSort, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, AP_Scout, 2, MUIM_Application_ReturnID, ID_LOCKSORT);
  1985.          DoMethod (lockpattern,MUIM_Notify,MUIA_String_Acknowledge,MUIV_EveryTime,AP_Scout,2,MUIM_Application_ReturnID,ID_LOCKUPDATE);
  1986.  
  1987.          SetCloseRequest (WI_Locks,ID_LOCKEXIT);
  1988.          SetListActive (locklist,ID_LOCKLV_ACTIVE);
  1989.  
  1990.          SetWindowOpen (WI_Locks,lockpattern,ID_LOCKEXIT);
  1991.       }
  1992.    } else if ((! state) && (WI_Locks)) {
  1993.       SetWindowClose (WI_Locks,TRUE);
  1994.  
  1995.       FreeLocks();
  1996.  
  1997.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Locks);
  1998.       MUI_DisposeObject (WI_Locks);
  1999.       WI_Locks = NULL;
  2000.       locklist = NULL;
  2001.    }
  2002. }
  2003.  
  2004. APTR WI_Ports, portlist, porttext, portcount, CY_PortSort;
  2005. int  portsortstate = 0;
  2006. APTR BT_PortUpdate, BT_PortPrint, BT_PortRemove, BT_PortPriority, BT_PortMore, BT_PortExit;
  2007.  
  2008. APTR PortSortList[] = {
  2009.    &tasklist_cmpprihook,
  2010.    &list_cmpnamehook,
  2011.    &tasklist_cmpaddresshook,
  2012.    NULL
  2013. };
  2014.  
  2015. static const char *CYA_PortSortText[] = {
  2016.    "priority",
  2017.    "name",
  2018.    "address",
  2019.    NULL
  2020. };
  2021.  
  2022. char ports_title[WINDOWTITLELEN];
  2023.  
  2024. void PortsWindow (BOOL state) {
  2025.    if (state) {
  2026.       if (WI_Ports) {
  2027.          ShowPorts();
  2028.       } else {
  2029.          WI_Ports = WindowObject,
  2030.          MUIA_Window_Title, MyGetWindowTitle (ports_title, "PORTS"),
  2031.          MUIA_HelpNode, PortsText,
  2032.          MUIA_Window_ID, MakeListID('P','O','R','T'),
  2033.          WindowContents, VGroup,
  2034.             Child, portlist = MyListviewObject ("COL=0 DELTA=8,COL=1 DELTA=8,COL=2 DELTA=8 P=\33r,COL=3 DELTA=8 P=\33c,COL=4",&portlist_dsphook),
  2035.             Child, MyBelowSortedListview (&porttext, &portcount, &CY_PortSort, CYA_PortSortText, portsortstate),
  2036.             Child, MyVSpace(2),
  2037.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  2038.                Child, BT_PortUpdate   = KeyButtonA (UpdateText  ,ID_PORTUPDATE),
  2039.                Child, BT_PortPrint    = KeyButtonA (PrintText   ,ID_PORTPRINT),
  2040.                Child, BT_PortRemove   = KeyButtonA (RemoveText  ,ID_PORTREMOVE),
  2041.                Child, BT_PortPriority = KeyButtonA (PriorityText,ID_PORTPRIORITY),
  2042.                Child, BT_PortMore     = KeyButtonA (MoreText    ,ID_PORTMORE),
  2043.                Child, BT_PortExit     = KeyButtonA (ExitText    ,ID_PORTEXIT),
  2044.             End,
  2045.          End, End;
  2046.  
  2047.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Ports);
  2048.          DoMethod (WI_Ports,MUIM_Window_SetCycleChain,portlist,CY_PortSort,BT_PortUpdate,BT_PortPrint,BT_PortRemove,BT_PortPriority,BT_PortMore,BT_PortExit,NULL);
  2049.          DoMethod (CY_PortSort, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, AP_Scout, 2, MUIM_Application_ReturnID, ID_PORTSORT);
  2050.  
  2051.          SetCloseRequest (WI_Ports,ID_PORTEXIT);
  2052.          SetListActive (portlist,ID_PORTLV_ACTIVE);
  2053.          SetListviewDoubleClick (portlist,ID_PORTMORE);
  2054.  
  2055.          ShowPorts();
  2056.  
  2057.          SetWindowOpen (WI_Ports,portlist,ID_PORTEXIT);
  2058.       }
  2059.    } else if ((! state) && (WI_Ports)) {
  2060.       SetWindowClose (WI_Ports,TRUE);
  2061.  
  2062.       FreePorts();
  2063.  
  2064.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Ports);
  2065.       MUI_DisposeObject (WI_Ports);
  2066.       WI_Ports = NULL;
  2067.       portlist = NULL;
  2068.    }
  2069. }
  2070.  
  2071. char memory_title[WINDOWTITLELEN];
  2072.  
  2073. void MemoryWindow (BOOL state) {
  2074.    if (state) {
  2075.       if (WI_Memory) {
  2076.          ShowMemory();
  2077.       } else {
  2078.          WI_Memory = WindowObject,
  2079.          MUIA_Window_Title, MyGetWindowTitle (memory_title, "MEMORY"),
  2080.          MUIA_HelpNode, MemoryText,
  2081.          MUIA_Window_ID, MakeListID('M','E','M','O'),
  2082.          WindowContents, VGroup,
  2083.             Child, memlist = MyListviewObject ("COL=0 DELTA=8,COL=1 DELTA=8,COL=2 DELTA=8,COL=3 DELTA=8 P=\33r,COL=4 DELTA=8,COL=5 DELTA=8,COL=6",&memlist_dsphook),
  2084.             Child, memtext = MyTextObject(),
  2085.             Child, MyVSpace(2),
  2086.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  2087.                Child, BT_MemPrint    = KeyButtonA (PrintText   ,ID_MEMPRINT),
  2088.                Child, BT_MemPriority = KeyButtonA (PriorityText,ID_MEMPRIORITY),
  2089.                Child, BT_MemMore     = KeyButtonA (MoreText    ,ID_MEMMORE),
  2090.                Child, BT_MemExit     = KeyButtonA (ExitText    ,ID_MEMEXIT),
  2091.             End,
  2092.          End, End;
  2093.  
  2094.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Memory);
  2095.          DoMethod (WI_Memory,MUIM_Window_SetCycleChain,memlist,BT_MemPrint,BT_MemPriority,BT_MemMore,BT_MemExit,NULL);
  2096.  
  2097.          SetCloseRequest (WI_Memory,ID_MEMEXIT);
  2098.          SetListActive (memlist,ID_MEMLV_ACTIVE);
  2099.          SetListviewDoubleClick (memlist,ID_MEMMORE);
  2100.  
  2101.          ShowMemory();
  2102.  
  2103.          SetWindowOpen (WI_Memory,memlist,ID_MEMEXIT);
  2104.       }
  2105.    } else if ((! state) && (WI_Memory)) {
  2106.       SetWindowClose (WI_Memory,TRUE);
  2107.  
  2108.       FreeMemory();
  2109.  
  2110.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Memory);
  2111.       MUI_DisposeObject (WI_Memory);
  2112.       WI_Memory = NULL;
  2113.       memlist = NULL;
  2114.    }
  2115. }
  2116.  
  2117. APTR WI_Assigns, asslist, asstext, asscount, CY_AssSort;
  2118. int  asssortstate = 0;
  2119. APTR BT_AssUpdate, BT_AssPrint, BT_AssRemove, BT_AssExit;
  2120.  
  2121. APTR AssSortList[] = {
  2122.    &list_cmpnormalhook,
  2123.    &list_cmpnamehook,
  2124.    &list_cmpaddresshook,
  2125.    NULL
  2126. };
  2127.  
  2128. static const char *CYA_AssSortText[] = {
  2129.    "normal",
  2130.    "name",
  2131.    "address",
  2132.    NULL
  2133. };
  2134.  
  2135. char assigns_title[WINDOWTITLELEN];
  2136.  
  2137. void AssignsWindow (BOOL state) {
  2138.    if (state) {
  2139.       if (WI_Assigns) {
  2140.          ShowAssigns();
  2141.       } else {
  2142.          WI_Assigns = WindowObject,
  2143.          MUIA_Window_Title, MyGetWindowTitle (assigns_title, "ASSIGNS"),
  2144.          MUIA_HelpNode, AssignsText,
  2145.          MUIA_Window_ID, MakeListID('A','S','S','I'),
  2146.          WindowContents, VGroup,
  2147.             Child, asslist = MyListviewObject ("COL=0 DELTA=8,COL=1 DELTA=8,COL=2",&asslist_dsphook),
  2148.             Child, MyBelowSortedListview (&asstext, &asscount, &CY_AssSort, CYA_AssSortText, asssortstate),
  2149.             Child, MyVSpace(2),
  2150.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  2151.                Child, BT_AssUpdate  = KeyButtonA (UpdateText,ID_ASSUPDATE),
  2152.                Child, BT_AssPrint   = KeyButtonA (PrintText ,ID_ASSPRINT),
  2153.                Child, BT_AssRemove  = KeyButtonA (RemoveText,ID_ASSREMOVE),
  2154.                Child, BT_AssExit    = KeyButtonA (ExitText  ,ID_ASSEXIT),
  2155.             End,
  2156.          End, End;
  2157.  
  2158.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Assigns);
  2159.          DoMethod (WI_Assigns,MUIM_Window_SetCycleChain,asslist,CY_AssSort,BT_AssUpdate,BT_AssPrint,BT_AssRemove,BT_AssExit,NULL);
  2160.          DoMethod (CY_AssSort, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, AP_Scout, 2, MUIM_Application_ReturnID, ID_ASSSORT);
  2161.  
  2162.          SetCloseRequest (WI_Assigns,ID_ASSEXIT);
  2163.          SetListActive (asslist,ID_ASSLV_ACTIVE);
  2164.  
  2165.          ShowAssigns();
  2166.  
  2167.          SetWindowOpen (WI_Assigns,asslist,ID_ASSEXIT);
  2168.       }
  2169.    } else if ((! state) && (WI_Assigns)) {
  2170.       SetWindowClose (WI_Assigns,TRUE);
  2171.  
  2172.       FreeAssigns();
  2173.  
  2174.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Assigns);
  2175.       MUI_DisposeObject (WI_Assigns);
  2176.       WI_Assigns = NULL;
  2177.       asslist = NULL;
  2178.    }
  2179. }
  2180.  
  2181. char vectors_title[WINDOWTITLELEN];
  2182.  
  2183. void VectorsWindow (BOOL state) {
  2184.    if (state) {
  2185.       if (WI_Vectors) {
  2186.          GetVectors();
  2187.       } else {
  2188.          WI_Vectors = WindowObject,
  2189.          MUIA_Window_Title, MyGetWindowTitle (vectors_title, "VECTORS"),
  2190.          MUIA_HelpNode, VectorsText,
  2191.          MUIA_Window_ID, MakeListID('V','E','C','T'),
  2192.          WindowContents, VGroup,
  2193.  
  2194.             Child, RegisterGroup(VectorPages),
  2195.  
  2196.                Child, HGroup, 
  2197.                   GroupFrameT("Reset Vectors"),
  2198.                   Child, HGroup,
  2199.                      Child, MyLabel2 (ESC "rColdCapture:\nCoolCapture:\nWarmCapture:\nKickMemPtr:\nKickTagPtr:\nKickCheckSum:"),
  2200.                      Child, vectext1 = MyTextObject2(),
  2201.                   End,
  2202.                End,
  2203.  
  2204.                Child, HGroup, 
  2205.                   GroupFrameT("Auto Vector Interrupts"),
  2206.                   Child, HGroup,
  2207.                      Child, MyLabel2 (ESC "rLevel1 ($0064):\nLevel2 ($0068):\nLevel3 ($006c):\nLevel4 ($0070):\nLevel5 ($0074):\nLevel6 ($0078):\nLevel7 ($007c):"),
  2208.                      Child, vectext2 = MyTextObject2(),
  2209.                   End,
  2210.                End,
  2211.  
  2212.                Child, HGroup, 
  2213.                   GroupFrameT("Interrupt Vectors"),
  2214.                   Child, HGroup,
  2215.                      Child, MyLabel (ESC "rTBE\nDSKBLK\nSOFTINT\nPORTS\nCOPPER\nVERTB\nBLITTER\nAUDIO0"),
  2216.                      Child, MyLabel (ESC "r 0:\n1:\n2:\n3:\n4:\n5:\n6:\n7:"),
  2217.                      Child, vectext3 = MyTextObject2(),
  2218.                   End,
  2219.                   Child, HGroup,
  2220.                      Child, MyLabel (ESC "rAUDIO1\nAUDIO2\nAUDIO3\nRBF\nDSKSYNC\nEXTER\nINTEN\nNMI"),
  2221.                      Child, MyLabel (ESC "r8:\n9:\n10:\n11:\n12:\n13:\n14:\n15:"),
  2222.                      Child, vectext4 = MyTextObject2(),
  2223.                   End,
  2224.                End,
  2225.             End,
  2226. #ifndef WINDOW_PROBLEMS
  2227.             Child, MyVSpace(4),
  2228. #endif
  2229.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  2230.                Child, BT_VecUpdate = KeyButtonA (UpdateText,ID_VECUPDATE),
  2231.                Child, BT_VecPrint  = KeyButtonA (PrintText ,ID_VECPRINT),
  2232.                Child, BT_VecExit   = KeyButtonA (ExitText  ,ID_VECEXIT),
  2233.             End,
  2234.          End, End;
  2235.  
  2236.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Vectors);
  2237.          DoMethod (WI_Vectors,MUIM_Window_SetCycleChain,BT_VecUpdate,BT_VecPrint,BT_VecExit,NULL);
  2238.          SetCloseRequest (WI_Vectors,ID_VECEXIT);
  2239.  
  2240.          GetVectors();
  2241.  
  2242.          SetWindowOpen (WI_Vectors,NULL,ID_VECEXIT);
  2243.       }
  2244.    } else if ((! state) && (WI_Vectors)) {
  2245.       SetWindowClose (WI_Vectors,TRUE);
  2246.  
  2247. //      FreeVectors();
  2248.  
  2249.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Vectors);
  2250.       MUI_DisposeObject (WI_Vectors);
  2251.       WI_Vectors = NULL;
  2252.    }
  2253. }
  2254.  
  2255.  
  2256. char allocations_title[WINDOWTITLELEN];
  2257.  
  2258. void AllocationsWindow (BOOL state) {
  2259.    if (state) {
  2260.       if (WI_Allocations) {
  2261.          GetAllocations();
  2262.       } else {
  2263.          WI_Allocations = WindowObject,
  2264.          MUIA_Window_Title, MyGetWindowTitle (allocations_title, "ALLOCATIONS"),
  2265.          MUIA_HelpNode, AllocationsText,
  2266.          MUIA_Window_ID, MakeListID('A','L','L','C'),
  2267.          WindowContents, VGroup,
  2268.  
  2269.             Child, RegisterGroup(AllocationsPages),
  2270.  
  2271.                Child, HGroup,
  2272.                   Child, HGroup,
  2273.                      GroupFrameT("CIA A"),
  2274.                      Child, HGroup,
  2275.                         Child, MyLabel2 (ESC "rTimer A:\nTimer B:\nAlarm:\nSerial:\nFlag:"),
  2276.                         Child, alctext1 = MyTextObject(),
  2277.                      End,
  2278.                   End,
  2279.  
  2280.                   Child, HGroup,
  2281.                      GroupFrameT("CIA B"),
  2282.                      Child, HGroup,
  2283.                         Child, MyLabel2 (ESC "rTimer A:\nTimer B:\nAlarm:\nSerial:\nFlag:"),
  2284.                         Child, alctext2 = MyTextObject(),
  2285.                      End,
  2286.                   End,
  2287.                End,
  2288.  
  2289.                Child, HGroup,
  2290.                   GroupFrameT("Ports"),
  2291.                   Child, HGroup,
  2292.                      Child, MyLabel2 (ESC "rSerial Port:\nSerial Control:\nParallel Port:\nParallel Control:"),
  2293.                      Child, alctext3 = MyTextObject(),
  2294.                   End,
  2295.                End,
  2296.             End,
  2297.  
  2298. #ifndef WINDOW_PROBLEMS
  2299.             Child, MyVSpace(4),
  2300. #endif
  2301.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  2302.                Child, BT_AlcUpdate = KeyButtonA (UpdateText,ID_ALCUPDATE),
  2303.                Child, BT_AlcPrint  = KeyButtonA (PrintText ,ID_ALCPRINT),
  2304.                Child, BT_AlcExit   = KeyButtonA (ExitText  ,ID_ALCEXIT),
  2305.             End,
  2306.          End, End;
  2307.  
  2308.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Allocations);
  2309.          DoMethod (WI_Allocations,MUIM_Window_SetCycleChain,BT_AlcUpdate,BT_AlcPrint,BT_AlcExit,NULL);
  2310.          SetCloseRequest (WI_Allocations,ID_ALCEXIT);
  2311.  
  2312.          GetAllocations();
  2313.  
  2314.          SetWindowOpen (WI_Allocations,NULL,ID_ALCEXIT);
  2315.       }
  2316.    } else if ((! state) && (WI_Allocations)) {
  2317.       SetWindowClose (WI_Allocations,TRUE);
  2318.  
  2319. //      FreeAllocations();
  2320.  
  2321.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Allocations);
  2322.       MUI_DisposeObject (WI_Allocations);
  2323.       WI_Allocations = NULL;
  2324.    }
  2325. }
  2326.  
  2327.  
  2328. APTR WI_Commands, comlist, comtext, comcount, CY_ComSort;
  2329. int  comsortstate = 0;
  2330. APTR BT_ComUpdate, BT_ComPrint, BT_ComRemove, BT_ComExit;
  2331.  
  2332. APTR ComSortList[] = {
  2333.    &list_cmpnormalhook,
  2334.    &list_cmpnamehook,
  2335.    &list_cmpaddresshook,
  2336.    NULL
  2337. };
  2338.  
  2339. static const char *CYA_ComSortText[] = {
  2340.    "normal",
  2341.    "name",
  2342.    "address",
  2343.    NULL
  2344. };
  2345.  
  2346. char commands_title[WINDOWTITLELEN];
  2347.  
  2348. void CommandsWindow (BOOL state) {
  2349.    if (state) {
  2350.       if (WI_Commands) {
  2351.          ShowCommands();
  2352.       } else {
  2353.          WI_Commands = WindowObject,
  2354.          MUIA_Window_Title, MyGetWindowTitle (commands_title, "RESIDENT COMMANDS"),
  2355.          MUIA_HelpNode, CommandsText,
  2356.          MUIA_Window_ID, MakeListID('R','C','O','M'),
  2357.          WindowContents, VGroup,
  2358.             Child, comlist = MyListviewObject ("COL=0 DELTA=8,COL=1 DELTA=8,COL=2 DELTA=8 P=\33c,COL=3 DELTA=8,COL=4 DELTA=8,COL=5 P=\33r",&comlist_dsphook),
  2359.             Child, MyBelowSortedListview (&comtext, &comcount, &CY_ComSort, CYA_ComSortText, comsortstate),
  2360.             Child, MyVSpace(2),
  2361.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  2362.                Child, BT_ComUpdate = KeyButtonA (UpdateText,ID_COMUPDATE),
  2363.                Child, BT_ComPrint  = KeyButtonA (PrintText ,ID_COMPRINT),
  2364.                Child, BT_ComRemove = KeyButtonA (RemoveText,ID_COMREMOVE),
  2365.                Child, BT_ComExit   = KeyButtonA (ExitText  ,ID_COMEXIT),
  2366.             End,
  2367.          End, End;
  2368.  
  2369.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_Commands);
  2370.          DoMethod (WI_Commands,MUIM_Window_SetCycleChain,comlist,CY_ComSort,BT_ComUpdate,BT_ComPrint,BT_ComRemove,BT_ComExit,NULL);
  2371.          DoMethod (CY_ComSort, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, AP_Scout, 2, MUIM_Application_ReturnID, ID_COMSORT);
  2372.  
  2373.          SetCloseRequest (WI_Commands,ID_COMEXIT);
  2374.          SetListActive (comlist,ID_COMLV_ACTIVE);
  2375.  
  2376.          ShowCommands();
  2377.  
  2378.          SetWindowOpen (WI_Commands,comlist,ID_COMEXIT);
  2379.       }
  2380.    } else if ((! state) && (WI_Commands)) {
  2381.       SetWindowClose (WI_Commands,TRUE);
  2382.  
  2383.       FreeCommands();
  2384.  
  2385.       DoMethod (AP_Scout,OM_REMMEMBER,WI_Commands);
  2386.       MUI_DisposeObject (WI_Commands);
  2387.       WI_Commands = NULL;
  2388.       comlist = NULL;
  2389.    }
  2390. }
  2391.  
  2392.  
  2393. APTR WI_System, syslist, systext;
  2394.  
  2395. char system_title[WINDOWTITLELEN];
  2396.  
  2397. void SystemWindow (BOOL state) {
  2398.    if (state) {
  2399.       if (WI_System) {
  2400.          ShowSystem();
  2401.       } else {
  2402.          WI_System = WindowObject,
  2403.          MUIA_Window_Title, MyGetWindowTitle (system_title, "SYSTEM"),
  2404.          MUIA_HelpNode, SystemText,
  2405.          MUIA_Window_ID, MakeListID('S','Y','S','T'),
  2406.          WindowContents, VGroup,
  2407.             Child, syslist = ListviewObject,
  2408.                MUIA_Listview_Input, FALSE,
  2409.                MUIA_Listview_List, ListObject,
  2410.                   MUIA_Font, MUIV_Font_Fixed,
  2411.                   ReadListFrame,
  2412.                   MUIA_List_Format, "DELTA=8 BAR P=\33r,",
  2413.                   MUIA_List_DisplayHook, &syslist_dsphook,
  2414.                End,
  2415.             End,
  2416.             Child, MyVSpace(2),
  2417.             Child, HGroup, MUIA_Group_SameSize, TRUE,
  2418.                Child, BT_SysUpdate = KeyButtonA (UpdateText,ID_SYSUPDATE),
  2419.                Child, BT_SysPrint  = KeyButtonA (PrintText ,ID_SYSPRINT),
  2420.                Child, BT_SysExit   = KeyButtonA (ExitText  ,ID_SYSEXIT),
  2421.             End,
  2422.          End, End;
  2423.  
  2424.  
  2425.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_System);
  2426.          DoMethod (WI_System,MUIM_Window_SetCycleChain,syslist,BT_SysPrint,BT_SysExit,NULL);
  2427.          SetCloseRequest (WI_System,ID_SYSEXIT);
  2428.  
  2429.          ShowSystem();
  2430.  
  2431.          SetWindowOpen (WI_System,NULL,ID_SYSEXIT);
  2432.       }
  2433.    } else if ((! state) && (WI_System)) {
  2434.       SetWindowClose (WI_System,TRUE);
  2435.       FreeSystem();
  2436.       DoMethod (AP_Scout,OM_REMMEMBER,WI_System);
  2437.       MUI_DisposeObject (WI_System);
  2438.       WI_System = NULL;
  2439.    }
  2440. }
  2441.  
  2442.  
  2443. void AboutWindow (BOOL state) {
  2444.    if ((state) && (! WI_About)) {
  2445.       WI_About = WindowObject,
  2446.       MUIA_Window_Title, PROGNAME " " PROGVERSION "." PROGREVISION,
  2447.       WindowContents, VGroup,
  2448.          Child, AboutText= MyTextObject2(),
  2449.          Child, MyVSpace(4),
  2450.          Child, HGroup, MUIA_Group_SameSize, TRUE,
  2451.             Child, MyHSpace(0),
  2452.             Child, BT_AboutContinue = KeyButtonA (ContinueText,ID_ABOUTCONTINUE),
  2453.             Child, MyHSpace(0),
  2454.          End,
  2455.       End, End;
  2456.  
  2457.       if (WI_About) {
  2458.          MySetContents (AboutText,"%s%s\n",AboutText1,portname);
  2459.  
  2460.          DoMethod (AP_Scout,OM_ADDMEMBER,WI_About);
  2461.          SetCloseRequest (WI_About,ID_ABOUTCONTINUE);
  2462.  
  2463.          SetWindowOpen (WI_About,BT_AboutContinue,NULL);
  2464.       }
  2465.    } else if ((! state) && (WI_About)) {
  2466.       SetWindowClose (WI_About,FALSE);
  2467.  
  2468.       DoMethod (AP_Scout,OM_REMMEMBER,WI_About);
  2469.       MUI_DisposeObject (WI_About);
  2470.       WI_About = NULL;
  2471.    }
  2472. }
  2473.  
  2474.